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

Use the same profile name for both Cargo and wasm-pack

Open srussvoll opened this issue 9 months ago • 2 comments

When running wasm-pack with a custom profile (wasm-pack build . --profile custom_profile_name), the Cargo profile with name custom_profile_name will be used, but wasm-pack will use a profile called custom.

More concisely, Cargo will use [profile.custom_profile_name], whereas wasm-pack will use [package.metadata.wasm-pack.profile.custom]

This PR makes wasm-pack use the custom profile name provided with the --profile option so that wasm-pack will now use [package.metadata.wasm-pack.profile.custom_profile_name].

Closes #1488.

Make sure these boxes are checked! 📦✅

  • [x] You have the latest version of rustfmt installed
$ rustup component add rustfmt
  • [x] You ran cargo fmt on the code base before submitting
  • [x] You reference which issue is being closed in the PR text

✨✨ 😄 Thanks so much for contributing to wasm-pack! 😄 ✨✨

srussvoll avatar Apr 02 '25 13:04 srussvoll

To my knowledge the custom profile is currently undocumented, and the feature has not yet been released. But since some users is likely using the git repository to install wasm-pack, I added a deprecation warning for the custom profile. Is this desirable?

srussvoll avatar Apr 02 '25 13:04 srussvoll

hey ! should this allow

[package.metadata.wasm-pack.profile.custom]
wasm-opt = ['-Oz', '--enable-bulk-memory']

and using --profile custom doesn't use the flags set

mirsella avatar Jul 20 '25 20:07 mirsella