You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to pass global options to cargo. In particular, I use --locked and --offline quite heavily. --locked is useful to avoid unwanted updates. --offline is important if I'm in a poor (or expensive) network environment.
💡 Feature description
Currently, -- introduces options to cargo build. It's not so easy to shoehorn an additional free-form list of arguments. I suggest we take a leaf from compiler drivers like gcc, and introduce a repeatable option that adds one additional cargo argument.
If your cargo is actually rustup pretending to be cargo (so normally you can say cargo +nightly build) and you encounter #629, you could say
wasm-pack --cargo-opt=+nightly build
Alternatives
The only plausible alternative for a user like me right now, without some change to wasm-pack, is to live with the unwanted lockfile updates, or to put a stunt wrapper for cargo on the PATH. Or to abandon wasm-pack and go to wasm-bindgen-cli.
As for the proposed command line syntax for wasm-pack, I think --cargo-opt=... is probably the best but I'm happy to implement whatever syntax you prefer. If you are looking for prior art, gcc has -Wl,--some-linker-option, but that's not very readable. -C... would be a possibility but steals a single-letter option.
I'm sure the value ought to be the whole thing passed to cargo, not just the part after --. Anything else would be really very confusing.
Another possibilty would be to do something more complicated, perhaps with --- meaning something special, but it doesn't seem desirable for wasm-pack's command line parsing to be funky and exciting. It should be straightforward, and rather unusual use cases like mine definitely don't need super-brief syntax.
The text was updated successfully, but these errors were encountered:
ijackson
added a commit
to ijackson/wasm-pack
that referenced
this issue
Oct 10, 2020
Motivation
I would like to be able to pass global options to cargo. In particular, I use
--locked
and--offline
quite heavily.--locked
is useful to avoid unwanted updates.--offline
is important if I'm in a poor (or expensive) network environment.💡 Feature description
Currently,
--
introduces options tocargo build
. It's not so easy to shoehorn an additional free-form list of arguments. I suggest we take a leaf from compiler drivers likegcc
, and introduce a repeatable option that adds one additional cargo argument.💻 Basic example
So, you could say something like
If your cargo is actually rustup pretending to be cargo (so normally you can say
cargo +nightly build
) and you encounter #629, you could sayAlternatives
The only plausible alternative for a user like me right now, without some change to
wasm-pack
, is to live with the unwanted lockfile updates, or to put a stunt wrapper for cargo on the PATH. Or to abandonwasm-pack
and go towasm-bindgen-cli
.As for the proposed command line syntax for wasm-pack, I think
--cargo-opt=...
is probably the best but I'm happy to implement whatever syntax you prefer. If you are looking for prior art,gcc
has-Wl,--some-linker-option
, but that's not very readable.-C...
would be a possibility but steals a single-letter option.I'm sure the value ought to be the whole thing passed to cargo, not just the part after
--
. Anything else would be really very confusing.Another possibilty would be to do something more complicated, perhaps with
---
meaning something special, but it doesn't seem desirable for wasm-pack's command line parsing to be funky and exciting. It should be straightforward, and rather unusual use cases like mine definitely don't need super-brief syntax.The text was updated successfully, but these errors were encountered: