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

web target should allow for importing npm modules #2065

Closed
Pauan opened this issue Apr 1, 2020 · 0 comments · Fixed by #2103
Closed

web target should allow for importing npm modules #2065

Pauan opened this issue Apr 1, 2020 · 0 comments · Fixed by #2103

Comments

@Pauan
Copy link
Contributor

Pauan commented Apr 1, 2020

When using the following code with --target web...

#[wasm_bindgen(module = "foo")]
extern "C" {
    fn foo();
}

...it gives the following error:

error: NPM dependencies have been specified in `package.json` but this is only compatible with the `bundler` and `nodejs` targets

This error is confusing, but more importantly we should allow for npm modules with --target web because:

  1. The Rollup plugin uses --target web internally because it cannot use --target bundler. Rollup can handle npm modules perfectly fine, so this should be allowed.

  2. There are plans to have web native modules, such as std::kv-storage (which was ultimately removed, but there will be other native modules in the future).

  3. By using import maps it is possible to load npm modules in the browser.

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 a pull request may close this issue.

1 participant