rust-webpack-template
rust-webpack-template copied to clipboard
`npm run start` compiles crate in "dev" profile by default
Describe the Bug
npm run start uses the WasmPackPlugin to compile the associated crate, and that plugin compiles in "dev" profile by default.
This wasn't obvious (to me), and it seems that it contravenes other documentation in the wasm-pack book that indicates that wasm-pack build defaults to "release" profile.
As a result, I found it very confusing when profiling the (slow vs js) performance of a fairly simple wasm module that I had built and was running from this template.
Steps to Reproduce
npm init rust-webpack my-appcd my-appnpm run start- Crate is compiled in dev profile, but there is no indication in the README, webpack.config.js, or the terminal that this is so.
Expected Behavior
I was expecting that the crate would be compiled in "release" profile, since the wasm-pack documentation says that that is its default.
Actual Behavior
The crate is is compiled in "dev" profile.
I made a PR (#117) to add some info to the webpack config that would have helped me.
If it would be useful, I'd be happy to make a follow-up PR to modify the README to point this out, or take a stab at modifying the command-line output to add "in X profile" to the Compiling your crate... message.
It would be great if you can change the compilation message to indicate the env, :+1:
You can find it here https://github.com/wasm-tool/wasm-pack-plugin/blob/b26fc434ef8c87b7807a0ddd68fae962c0b37ae0/plugin.js#L70
@xtuc Thanks! Added a PR for the wasm-pack-plugin: https://github.com/wasm-tool/wasm-pack-plugin/pull/54