diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 830fd025..0814a9fa 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -1982,7 +1982,8 @@ impl<'a> Context<'a> { if !self.config.mode.nodejs() && !self.config.mode.bundler() { bail!( "NPM dependencies have been specified in `{}` but \ - this is only compatible with the `bundler` and `nodejs` targets" + this is only compatible with the `bundler` and `nodejs` targets", + path.display(), ); } diff --git a/crates/cli/tests/wasm-bindgen/npm.rs b/crates/cli/tests/wasm-bindgen/npm.rs index 1572a939..2ad9e66f 100644 --- a/crates/cli/tests/wasm-bindgen/npm.rs +++ b/crates/cli/tests/wasm-bindgen/npm.rs @@ -22,10 +22,15 @@ fn no_modules_rejects_npm() { .file("package.json", "") .wasm_bindgen("--no-modules"); cmd.assert() - .stderr("\ -error: failed to generate bindings for JS import `foo` - caused by: import from `foo` module not allowed with `--target no-modules`; use `nodejs`, `web`, or `bundler` target instead -") + .stderr( + str::is_match( + "\ +error: NPM dependencies have been specified in `.*` but this is only \ +compatible with the `bundler` and `nodejs` targets +", + ) + .unwrap(), + ) .failure(); }