Skip to content

Conversation

@ticky-xia
Copy link

@ticky-xia ticky-xia commented Nov 11, 2025

Added sideEffects field to package.json update.

Closes #1393

Added sideEffects field to package.json update.
@github-actions github-actions bot added the fix label Nov 11, 2025
@ticky-xia ticky-xia changed the title fix(js/scripts/build.sh): fix wasm init problem when run build in vite fix(js/scripts/build.sh): fix wasm init problem when run build in vite(#1393) Nov 12, 2025
@kylebarron
Copy link
Member

Thanks! Can you provide some sort of reference that shows this is needed?

@ticky-xia
Copy link
Author

Copy link
Member

@kylebarron kylebarron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only want this to apply to the code in bundler/ and not in all three submodules.

If you run

wasm-pack build --out-dir tmp_build/node \
  --out-name index \
  --target nodejs

then the generated module does not have a .sideEffects field.

And if you build for the web endpoint,

wasm-pack build --out-dir tmp_build/esm \
  --out-name index \
  --target web

then the generated package.json only has "./snippets/*" in the side effects; index.js is not included in the sideEffects array.

So I think you need to set

.sideEffects: [
	"bundler/index.js",
	"bundler/snippets/*",
	"node/snippets/*"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When run build in vite, it doesnt work in production

2 participants