Skip to content

Commit 3b2c061

Browse files
committed
feat: add sideEffects configuration
Only /encoding.js export has side-effects, and those side-effects are internal. It is documented to load multi-byte codecs for both this import and future /encoding-lite.js imports, even if the current import does not use the provided TextDecoder. This is because /encoding.js and /encoding-lite.js are designed to return the exact same TextDecoder class and methods, and loading full implementation provides multi-byte encodings support everywhere. The usecase is that /encoding-lite.js can potentially be used as a global polyfill, and the setup has to avoid polyfill conflicts if something loads /encoding.js and then something else replaces it with /encoding-lite.js
1 parent 7767772 commit 3b2c061

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@
237237
"./fallback/platform.js": "./fallback/platform.native.js",
238238
"./fallback/utf8.auto.js": "./fallback/utf8.auto.native.js"
239239
},
240+
"sideEffects": [
241+
"./encoding.js"
242+
],
240243
"peerDependencies": {
241244
"@noble/hashes": "^1.8.0 || ^2.0.0"
242245
},

0 commit comments

Comments
 (0)