Skip to content

Commit 84fd3c0

Browse files
committed
doc: encoding-browser caveat
1 parent fdc876a commit 84fd3c0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ _These are only provided as a compatibility layer, prefer hardened APIs instead
102102

103103
Alternate exports exist that can help reduce bundle size:
104104

105-
* `@exodus/bytes/encoding-browser.js` - resolves to a tiny import in browser bundles, preferring native `TextDecoder` / `TextEncoder`.
106-
For non-browsers (Node.js, React Native), loads a full implementation.
107-
108105
* `@exodus/bytes/encoding-lite.js` - if you don't need support for legacy multi-byte encodings.
109106

110107
Reduces the bundle size 10x, while still keeping `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec.
@@ -115,6 +112,13 @@ Alternate exports exist that can help reduce bundle size:
115112
This can be useful for example in React Native global TextDecoder polyfill,
116113
if you are sure that you don't need legacy multi-byte encodings support.
117114

115+
* `@exodus/bytes/encoding-browser.js` - resolves to a tiny import in browser bundles, preferring native `TextDecoder` / `TextEncoder`.
116+
117+
For non-browsers (Node.js, React Native), loads a full implementation.
118+
119+
Note: this is not the default behavior for `@exodus/bytes/encoding.js` because all major browser implementations have bugs, which
120+
`@exodus/bytes/encoding.js` fixes. Only use if you are ok with that.
121+
118122
Libraries are advised to use single-purpose hardened `@exodus/bytes/utf8.js` / `@exodus/bytes/utf16.js` APIs for Unicode.
119123

120124
Applications (including React Native apps) are advised to load either `@exodus/bytes/encoding-lite.js` or `@exodus/bytes/encoding.js`

0 commit comments

Comments
 (0)