-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unable to bundle WASM modules read by node:fs
#3904
Comments
There is a native support to import wasm in Node.js but behind a flag: --experimental-wasm-modules. Another possible way to do that is Both 2 methods above should be analysable by bundlers. The "standard" way to use wasm or any external files is not analysable as it is not a simple |
@hyrious Thanks for the quick reply. Yeah, I figured this was more or less a problem that could extend beyond the scope of ESBuild. By no means would I expect ESBuild to statically analyze usage of |
This is intentional. Emulating node's file system APIs is out of esbuild's scope. You can use |
Note that |
The ESBuild documentation provides a sample plugin that can bundle WASM modules. The primary issue with this plugin and the theory behind it is it assumes code is importing WASM modules like any other module (that is, using
import
orrequire()
). To my knowledge, this isn't standard (or at least, not yet), and this doesn't work for code trying to pull in WASM modules directly, such as from the file system.Under trivial situations, it may be possible to simply include the WASM file alongside the bundle, and the code will just "work". It's unclear whether this would work for more complex scenarios.
The text was updated successfully, but these errors were encountered: