Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra options (--features) result in wasm-pack error. #1059

Closed
iiSeymour opened this issue Sep 7, 2021 · 1 comment · Fixed by #1073
Closed

Extra options (--features) result in wasm-pack error. #1059

iiSeymour opened this issue Sep 7, 2021 · 1 comment · Fixed by #1073

Comments

@iiSeymour
Copy link

🐛 Bug description

Using --features as the last argument to wasm-pack does not get treated as an extra option that is passed to cargo build but an error -

$ wasm-pack build --release --target web --features wasm
error: Found argument '--features' which wasn't expected, or isn't valid in this context

USAGE:
    wasm-pack build --release --target <target>

For more information try --help

🤔 Expected Behavior

The build command can pass extra options straight to cargo build even if they are not supported in wasm-pack. To use them simply add the extra arguments at the very end of your command, just as you would for cargo build. For example, to build the previous example using cargo's offline feature:

wasm-pack build examples/js-hello-world --mode no-install --offline

https://rustwasm.github.io/wasm-pack/book/commands/build.html#extra-options

👟 Steps to reproduce

$ wasm-pack build --release --target web --features wasm
error: Found argument '--features' which wasn't expected, or isn't valid in this context

USAGE:
    wasm-pack build --release --target <target>

For more information try --help

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.10.1
rustc version: 1.54.0 (a178d0322 2021-07-26)

@abalmos
Copy link

abalmos commented Sep 23, 2021

@iiSeymour try

$ wasm-pack build --release --target web -- --features wasm

Looks like the docs need a PR.

FrankenApps added a commit to FrankenApps/wasm-pack that referenced this issue Oct 23, 2021
This is the correct way to pass extra arguments, such as features to cargo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants