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

Module not found: "env" #21

Closed
dflemstr opened this issue Feb 12, 2018 · 2 comments
Closed

Module not found: "env" #21

dflemstr opened this issue Feb 12, 2018 · 2 comments

Comments

@dflemstr
Copy link
Contributor

dflemstr commented Feb 12, 2018

When using wasm2es6js or even looking at the generated raw wasm file, the generated module refers to a module called "env". This module I assume should resolve to the main .js file generated by wasm-bindgen since it expects it to contain __wbindgen_throw according to the import table of the .wasm file.

However it also expects the __web_on_grow function which is not defined.

I'm attempting to integrate this tool with webpack. How should I map this "env" module?

@alexcrichton
Copy link
Contributor

Thanks for the report! In general the wasm2es6js tool though expects the wasm module it's being run over to look like an ES6 module, meaning that imports look like JS import statements and such. The Rust compiler, however, has no way of configuring (right now) the module to import from, it's always env. The wasm-bindgen tool in this repository communicates metadata from the rust file to the tool itself to rewrite the imports, but other imports from rustc aren't rewritten as wasm-bindgen doesn't know about them.

I suspect this won't be usable over "general" ES module files, but rather a different strategy would be needed for loading the wasm file.

@alexcrichton
Copy link
Contributor

I'm going to close this as I think this is a general "ES modules in wasm are a little underbaked issue" but otherwise the tool I believe is working as intended

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

2 participants