add test and some documentation for custom extra options passed to build command

master
Vsevolod Velichko 6 years ago
parent 669c43d853
commit 43488dae1d
  1. 11
      docs/src/commands/build.md
  2. 16
      tests/all/build.rs

@ -90,6 +90,17 @@ wasm-pack build examples/js-hello-world --mode no-install
| `no-install` | `wasm-pack init` implicitly and create wasm binding without installing `wasm-bindgen`. |
| `normal` | do all the stuffs of `no-install` with installed `wasm-bindgen`. |
## Extra options
The `build` command can pass extra options straight to `cargo build` even if they are not
supported in wasm-pack. To use them you should add standalone `--` argument at the very
end of your command, and all the arguments you want to pass to cargo should go after.
For example to build previous example using unstable cargo offline feature:
```
wasm-pack build examples/js-hello-world --mode no-install -- -Z offline
```
<hr style="font-size: 1.5em; margin-top: 2.5em"/>
<sup id="footnote-0">0</sup> If you need to include additional assets in the pkg

@ -248,3 +248,19 @@ fn it_format_out_dir_on_windows() {
"directories in wasm-pack.log should be well formatted",
);
}
#[test]
fn build_with_arbitrary_cargo_options() {
let fixture = utils::fixture::js_hello_world();
fixture.install_local_wasm_bindgen();
let cli = Cli::from_iter_safe(vec![
"wasm-pack",
"build",
&fixture.path.display().to_string(),
"--",
"--no-default-features",
])
.unwrap();
fixture.run(cli.cmd).unwrap();
}

Loading…
Cancel
Save