Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatible problem with pnpm when multiple esbuild version exists #963

Closed
hardfist opened this issue Mar 13, 2021 · 5 comments · Fixed by #970
Closed

compatible problem with pnpm when multiple esbuild version exists #963

hardfist opened this issue Mar 13, 2021 · 5 comments · Fixed by #970

Comments

@hardfist
Copy link
Contributor

It seems that pnpm will do some special tricks to bin files, which will cause esbuild fails when multiple esbuild version exisits,(it may be a bug of pnpm pnpm/pnpm#3238), but It's kind of unusual to make js entry files rely on bin files(it's usual that bin file relys on main js entry files), maybe not put the real bin into bin folder could solve the issue.

@hardfist
Copy link
Contributor Author

hardfist commented Mar 13, 2021

I think I find the reason, because esbuild modify bin file in post-install script, which violates pnpm's the hard-link & content-hash strategy, because different version of esbuild's bin's content is same before post-install , so different esbuild shared same hard-link of the same file(content-hash&hard-link strategy), but in post-install the both change their bin file, but they use the same hard-link ,the last modify will modify the result for both version, which will cause one version get wrong result, I currently change hard-link strategy to copy(mac not support COW currently), but I think esbuild could change the strategy so as to be compatible with pnpm's hard-link strategy.

@evanw
Copy link
Owner

evanw commented Mar 13, 2021

I made a change that I think might fix this: #970. It uses fs.renameSync instead of fs.writeFileSync which I assume doesn't mutate the hard-linked data. I'm not sure how to write a test for this though. Is it possible for you to verify that the code in that PR works somehow? I usually test this kind of stuff by running make platform-neutral to build the package into the npm/esbuild directory and then using npm pack to generate a *.tgz package that I can then npm install somewhere else. Not sure if it's possible to do that with pnpm or not as I am very unfamiliar with pnpm.

@hardfist
Copy link
Contributor Author

hardfist commented Mar 14, 2021

could you publish an alpha version so I can test it , there's somethings wrong with pnpm's link so it's not easy to test an unpublished version, and why not create an bin file then make bin entry points to the created bin file instead of replace the bin file

@evanw
Copy link
Owner

evanw commented Mar 19, 2021

I'm just going to try shipping it normally and see how that goes. You can try it out in the next release.

@evanw
Copy link
Owner

evanw commented Mar 20, 2021

This was published btw. Let me know if it's working for you now or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants