Skip to content

Commit

Permalink
chore: suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jun 7, 2023
1 parent 176e57b commit 667342b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ try {

## React Native

BSON vendors the required polyfills for `TextEncoder`, `TextDecoder`, `atob`, `btoa` when using React Native. One
additional polyfill, `crypto.getRandomValues` is required and can be installed with the following command:
BSON vendors the required polyfills for `TextEncoder`, `TextDecoder`, `atob`, `btoa` imported from React Native and therefore doesn't expect users to polyfill these. One additional polyfill, `crypto.getRandomValues` is recommended and can be installed with the following command:

```sh
npm install --save react-native-get-random-values
Expand Down
4 changes: 2 additions & 2 deletions etc/rollup/rollup-plugin-require-vendor/require_vendor.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MagicString from 'magic-string';

const REQUIRE_TEXT_ENCODING =
const REQUIRE_POLYFILLS =
`const { TextEncoder, TextDecoder } = require('../vendor/text-encoding');
const { encode: btoa, decode: atob } = require('../vendor/base64');\n`

Expand All @@ -20,7 +20,7 @@ export class RequireVendor {

// MagicString lets us edit the source code and still generate an accurate source map
const magicString = new MagicString(code);
magicString.prepend(REQUIRE_TEXT_ENCODING);
magicString.prepend(REQUIRE_POLYFILLS);

return {
code: magicString.toString(),
Expand Down

0 comments on commit 667342b

Please sign in to comment.