Closed
Description
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:
-
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. -
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). -
By using import maps it is possible to load npm modules in the browser.
Metadata
Metadata
Assignees
Labels
No labels