-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: BSON
Hello!
I'm trying to use the BSON library in a valid, standards compliant JavaScript runtime: Deno, but I seem to be encountering errors. I just need a working BSON library so I tried using even older versions of the library. Following are my results. Also, when I say "npm", I mean a hotlinking proxy, not run locally - but this doesn't change the results.
TypeScript from GitHub (v4.4.1 + most other versions)
Deno also supports TS, so I thought I'd try importing `https://raw.githubusercontent.com/mongodb/js-bson/master/src/bson.ts` directly. While it's valid, I get rate limited by GitHub since imports in ES6 are done asynchronously and are thus downloaded very quickly. Is probably also against GH TOS? So, not suitable for distributing my code.
NPM, v4.4.1, /dist/bson.browser.esm.js
Uncaught ReferenceError: global is not defined at dist/bson.browser.esm.js:2044:19
IMO, this would probably be the easiest to fix. I see that BSON already has a global shim variable that works in Deno, but there appears to be a conflicting search for the global variable at L2004, trying only `global` which isn't supported in Deno. For reference Deno supports all of the following references to "the global object":
- globalThis
- window
- self
- this
NPM, v.4.4.1, /dist/bson.bundle.js
Uncaught ReferenceError: global is not defined at dist/bson.bundle.js:2047:20 at dist/bson.bundle.js:9015:2
More versions incoming
- duplicates
-
NODE-3437 Unable to import in ES6
-
- Closed
-