You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This code is carefully used by require_rewriter.mjs any modifications must be reflected in the plugin.
43
-
*
44
-
* @remarks
45
-
* "crypto" is the only dependency BSON needs. This presents a problem for creating a bundle of the BSON library
46
-
* in an es module format that can be used both on the browser and in Node.js. In Node.js when BSON is imported as
47
-
* an es module, there will be no global require function defined, making the code below fallback to the much less desireable math.random bytes.
48
-
* In order to make our es module bundle work as expected on Node.js we need to change this `require()` to a dynamic import, and the dynamic
49
-
* import must be top-level awaited since es modules are async. So we rely on a custom rollup plugin to seek out the following lines of code
50
-
* and replace `require` with `await import` and the IIFE line (`nodejsRandomBytes = (() => { ... })()`) with `nodejsRandomBytes = await (async () => { ... })()`
0 commit comments