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
To enable tree-shaking of bundlers, wasm-pack generates package.json with sideEffects: false. It's OK before since the entry module generated by wasm-bindgen didn't have side effects:
Now sideEffects: false will let bundle remove the __wbg_set_wasm call from the entry module, which causes the let wasm; variable in binding module to be undefined.
🤔 Expected Behavior
What should have happened?
The sideEffects property should be set to a list of files with side effects. I think it should be the entry module's filename, i.e. sideEffects: ["./{entry_name}.js"].
👟 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.
🐛 Bug description
To enable tree-shaking of bundlers, wasm-pack generates
package.json
withsideEffects: false
. It's OK before since the entry module generated by wasm-bindgen didn't have side effects:But after rustwasm/wasm-bindgen@721c86c, it now has side effects:
Now
sideEffects: false
will let bundle remove the__wbg_set_wasm
call from the entry module, which causes thelet wasm;
variable in binding module to beundefined
.🤔 Expected Behavior
What should have happened?
The
sideEffects
property should be set to a list of files with side effects. I think it should be the entry module's filename, i.e.sideEffects: ["./{entry_name}.js"]
.👟 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.
yarn
to install dependencies and runyarn build
to build a bundle.dist/assets/index-*.js
. The file is not minified. You can see the__wbg_set_wasm
function and assignment tolet wasm;
variable is tree-shaked.node_modules/pkg/package.json
(notpkg/package.json
, the one to be used by Vite is in node_modules), setsideEffects
to["./game_of_life.js"]
.yarn build
dist/assets/index-*.js
. The file is not minified. You can see the__wbg_set_wasm
function is present and called correctly.The
pkg
directory in the archive is generated from https://github.com/BLaZeKiLL/game-of-life/tree/69443864176a39415c93c82d361caf2393126b80. With wasm-pack 0.10.3.🌍 Your environment
Include the relevant details of your environment.
wasm-pack version: 0.10.3
rustc version: 1.64.0
The text was updated successfully, but these errors were encountered: