Skip to content

Declare sideEffects in the published package.json - #36

Merged
samthor merged 1 commit into
samthor:masterfrom
retyui:add-side-effects
Nov 9, 2026
Merged

samthor merged 1 commit into
samthor:masterfrom
retyui:add-side-effects

Conversation

@retyui

@retyui retyui commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

text.min.js is a polyfill: when imported, it assigns TextEncoder / TextDecoder onto the global scope. The published package has no sideEffects field, so a tree-shaking bundler may drop a bare import 'fast-text-encoding' when it assumes the package has no side effects. This PR declares the field:

"sideEffects": [
  "./text.min.js"
]

The field goes into package/package.json, which release.sh publishes. The root package.json is the development one.

Test plan

  • Read the published 1.0.6 text.min.js.
  • ./text.min.js exists in the published tarball.

@retyui

retyui commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@samthor Hi! Small packaging fix: declares sideEffects: ["./text.min.js"] so bundlers don't tree-shake away the global polyfill. Would appreciate a look 🙏

@samthor
samthor merged commit ee981c0 into samthor:master Nov 9, 2026
1 check passed
@retyui
retyui deleted the add-side-effects branch November 9, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants