Closed
Description
🐛 Bug description
Custom JS snippets can contain top-level side-effects. Right now, wasm-pack generated package.json includes sideEffects: false
which marks every file as side-effect free, leading to potential bugs after bundling.
🤔 Expected Behavior
When JS snippet files are generated, they should be put into the sideEffects
array, and only the JS file generated by wasm-bindgen should be assumed to be side-effect free since it's the only one wasm-bindgen has control over.
package.json
allows to list potentially side-effect-y files as
{
"sideEffects": [
"path/to/snippet.js"
]
}
This will avoid bugs for snippets with top-level side-effects, while it won't decrease optimization level for common scenarios where the module is used via its main entry point.
Metadata
Metadata
Assignees
Labels
No labels