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

esbuild-wasm is now erroring out from missing builtin node packages on the web #2105

Closed
okikio opened this issue Mar 15, 2022 · 4 comments
Closed

Comments

@okikio
Copy link

okikio commented Mar 15, 2022

image

esbuild-wasm uses "fs", "crypto", etc... in the source code, but those packages can't be bundled and sent to the web so trying to use bundle esbuild-wasm for the web keeps failing, this specifically only occurs in versions >=v0.14.26 that includes the latest version as of this post v0.14.27.

You can replicate this issue here: https://stackblitz.com/github/okikio/bundle/tree/012f041ef099b6d9e734654adb2d7f8d4744aa2d?file=package.json

# Run 
npm run build

The error should appear.

@hyrious
Copy link

hyrious commented Mar 18, 2022

This might be a regression of #2081 that moves code including require("fs") from a string (will be evaluated by Function()) to outside.

We can try to wrap these code in a try-catch so that esbuild won't complain about these require calls.

@okikio
Copy link
Author

okikio commented Mar 18, 2022

I hope that the problem is fixed

@evanw
Copy link
Owner

evanw commented Mar 25, 2022

I believe this was accidentally fixed by me upgrading to Go 1.18.0, which separated out node-related stuff into another file: golang/go@680caf1. So this should be fixed in the upcoming release of esbuild.

@evanw evanw closed this as completed Mar 25, 2022
evanw added a commit that referenced this issue Mar 25, 2022
@okikio
Copy link
Author

okikio commented Mar 25, 2022

Awesome

zhusjfaker pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
hardfist pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
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

No branches or pull requests

3 participants