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

Use env variable ESBUILD_BINARY_PATH to use different binary path #597

Merged
merged 3 commits into from
Dec 18, 2020

Conversation

remorses
Copy link
Contributor

Fix #592

I also noticed that Yarn berry custom node binary is not used in windows, is that intentional?

@evanw
Copy link
Owner

evanw commented Dec 15, 2020

Is there a reason you're modifying the wrapper as well as the JavaScript API? Modifying the wrapper to behave differently when that environment variable is present seems unimportant if you're also changing the JavaScript API to avoid calling the wrapper in the first place when that environment variable is present. Unless your code is calling the executable wrapper directly without going through the JavaScript API, but in that case your code could just call your new executable directly without any assistance from this code. Can you say more about your use case? How are you calling esbuild when you want to debug it?

I also noticed that Yarn berry custom node binary is not used in windows, is that intentional?

A wrapper script is needed either if the installer is Yarn 2 or if the current OS is Windows. It's needed for Yarn 2 because Yarn 2 is incompatible with binary executables. If I remember correctly, it's needed with Windows because npm on Windows is incompatible with binary executables whose names don't end in .exe and I want the cross-platform command for esbuild to be esbuild not esbuild.exe. The check for Yarn 2 isn't done on Windows because the custom wrapper is always used on Windows regardless of whether you're using Yarn 2 or not, so there's nothing to do with the result of the check.

@remorses
Copy link
Contributor Author

remorses commented Dec 15, 2020

Is there a reason you're modifying the wrapper as well as the JavaScript API?

Sorry i didn't understand the reason of the yarn berry handling, now i understand it's because in yarn berry the location of the esbuild binary is different

I updated the code to always use ESBUILD_BINARY_PATH if defined

@remorses remorses marked this pull request as ready for review December 15, 2020 09:56
@evanw evanw merged commit b1cb605 into evanw:master Dec 18, 2020
evanw added a commit that referenced this pull request Dec 18, 2020
@evanw evanw mentioned this pull request Feb 25, 2021
@firien firien mentioned this pull request Jul 19, 2023
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 this pull request may close these issues.

How to use local esbuild binary in the npm package?
2 participants