mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-20 16:26:33 +00:00
Switch the --browser
argument to --web
This commit reverts part of the implementation of [RFC 6]. That RFC specified that the `--browser` flag was going to be repurposed for the new "natively loadable as ES module output", but unfortunately the breakage is far broader than initially expected. It turns out that `wasm-pack` passes `--browser` by default which means that a change to break `--browser` would break all historical versions of `wasm-pack` which is a bit much for now. To solve this the `--browser` flag is going back to what it represents on the current released version of `wasm-bindgen` (optimize away some node.js checks in a few places for bundler-style output) and a new `--web` flag is being introduced as the new deployment strategy. [RFC 6]: https://github.com/rustwasm/rfcs/pull/6 Closes #1318
This commit is contained in:
@ -108,7 +108,7 @@ fn rmain() -> Result<(), Error> {
|
||||
let mut b = Bindgen::new();
|
||||
b.debug(debug)
|
||||
.nodejs(node)?
|
||||
.browser(!node)?
|
||||
.web(!node)?
|
||||
.input_module(module, wasm)
|
||||
.keep_debug(false)
|
||||
.emit_start(false)
|
||||
|
@ -22,7 +22,8 @@ Options:
|
||||
--out-dir DIR Output directory
|
||||
--out-name VAR Set a custom output filename (Without extension. Defaults to crate name)
|
||||
--nodejs Generate output that only works in node.js
|
||||
--browser Generate output that only works in a browser
|
||||
--web Generate output that only works in a browser
|
||||
--browser Hint that JS should only be compatible with a browser
|
||||
--no-modules Generate output that only works in a browser (without modules)
|
||||
--no-modules-global VAR Name of the global variable to initialize
|
||||
--typescript Output a TypeScript definition file (on by default)
|
||||
@ -41,6 +42,7 @@ Options:
|
||||
struct Args {
|
||||
flag_nodejs: bool,
|
||||
flag_browser: bool,
|
||||
flag_web: bool,
|
||||
flag_no_modules: bool,
|
||||
flag_typescript: bool,
|
||||
flag_no_typescript: bool,
|
||||
@ -89,6 +91,7 @@ fn rmain(args: &Args) -> Result<(), Error> {
|
||||
let mut b = Bindgen::new();
|
||||
b.input_path(input)
|
||||
.nodejs(args.flag_nodejs)?
|
||||
.web(args.flag_web)?
|
||||
.browser(args.flag_browser)?
|
||||
.no_modules(args.flag_no_modules)?
|
||||
.debug(args.flag_debug)
|
||||
|
Reference in New Issue
Block a user