wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

error: the argument '--release' cannot be used with '--profile <PROFILE-NAME>'

Open loynoir opened this issue 1 year ago • 3 comments

🐛 Bug description

Describe your issue in detail.

error: the argument '--release' cannot be used with '--profile <PROFILE-NAME>'

🤔 Expected Behavior

What should have happened?

$ wasm-pack build --profile x-release --verbose
(No error)

👟 Steps to reproduce

Clear steps describing how to reproduce the issue, including commands and flags run. If you are seeing an error, please include the full error message and stack trace.

$ wasm-pack build --profile x-release --verbose
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
error: the argument '--release' cannot be used with '--profile <PROFILE-NAME>'

Usage: cargo build --lib --release --target [<TRIPLE>] --verbose...

For more information, try '--help'.
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 1
  full command: cd "/path/to/project" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown" "--profile" "x-release" "--verbose"
...

🌍 Your environment

Include the relevant details of your environment. wasm-pack version: rustc version:

$ wasm-pack --version                                    
wasm-pack 0.13.1

$ grep -P '^channel' rust-toolchain.toml
channel = "nightly-2025-01-06"

$ rustc --version
rustc 1.86.0-nightly (b3b368a18 2025-01-05)

$ cargo --version                                              
cargo 1.86.0-nightly (fd784878c 2025-01-03)

loynoir avatar Jan 09 '25 13:01 loynoir

I'm also trying to use a custom profile with wasm-pack so I can avoid mucking with my clean default release profile. I have a lot of different profiles being used for different build targets and they all inherit from release.

@loynoir did you find a workaround for this?

chris13524 avatar Jan 22 '25 20:01 chris13524

Unexpected but acceptable for me.

Did not try to find a workaround.

If I do, I would try

  • PATH=${CARGO_WRAPPER_X}:${PATH} wasm-pack build --profile X

Which wrapper will turn

  • cargo ... --release ...

  • cargo ... --release ... --profile X ...

Into

  • cargo ... --release ...

  • cargo ... --profile X ...

loynoir avatar Jan 23 '25 02:01 loynoir

This looks like the same issue as #1111, which was fixed by #1428. Unfortunately it has not been released on crates.io yet. The PR

  • #1489

further refines this to allow wasm-pack to use the custom profile name for its own configuration as well.

srussvoll avatar Apr 02 '25 13:04 srussvoll