-
Notifications
You must be signed in to change notification settings - Fork 273
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
Feature request: Support ESBuild #2294
Comments
I've just found this comment and can offer a solution. I created an esbuild plugin that rewrites the ENVIRONMENT_IS... variables with consts during load which then allows esbuild's dead code elimination to remove the nodejs specific code:
My library is compiled with It may be worth raising this in esbuild: if it could automatically replace the detection code (e.g. |
Is your feature request related to a problem? Please describe.
I would like to add stt_wasm to my esbuild pipeline. It currently fails because there are
require
statements in stt_wasm, which are guarded by ENVIRONMENT_IS_NODE during runtime, but not during compile time. I would like to be able to include stt_wasm in my deps and use a module import to include it in my project.Describe the solution you'd like
I'm not sure how to do it (once again, not a superior js programmer), but somehow guard the require statements or provide a default implementation when ENVIRONMENT_IS_NODE = false
Describe alternatives you've considered
Hacking the js files.
Providing an external implementation of require.
The text was updated successfully, but these errors were encountered: