update fetch to take a string parameter

This commit is contained in:
robert masen
2018-04-23 09:04:30 -05:00
parent cbccd2028d
commit 79a49b2a56
3 changed files with 20 additions and 30 deletions

View File

@ -22,7 +22,7 @@ Options:
-o --output FILE File to place output in
--typescript Output a `*.d.ts` file next to the JS output
--base64 Inline the wasm module using base64 encoding
--fetch Load module via `fetch()` instead of default webpack implementation
--fetch PATH Load module by passing the PATH argument to `fetch()`
Note that this is not intended to produce a production-ready output module
but rather is intended purely as a temporary \"hack\" until it's standard in
@ -34,7 +34,7 @@ struct Args {
flag_output: Option<PathBuf>,
flag_typescript: bool,
flag_base64: bool,
flag_fetch: bool,
flag_fetch: Option<String>,
arg_input: PathBuf,
}
@ -43,7 +43,7 @@ fn main() {
.and_then(|d| d.deserialize())
.unwrap_or_else(|e| e.exit());
if !args.flag_base64 && !args.flag_fetch {
if !args.flag_base64 && !args.flag_fetch.is_some() {
panic!("unfortunately only works right now with base64 or fetch");
}
@ -53,7 +53,7 @@ fn main() {
let object = wasm_bindgen_cli_support::wasm2es6js::Config::new()
.base64(args.flag_base64)
.fetch(args.flag_fetch, &args.arg_input)
.fetch(args.flag_fetch)
.generate(&wasm)
.expect("failed to parse wasm");