Version 3.2.0 includes a fix for "global" in node environments. Recent versions of rollup enforce a "no top-level this" rule and forces this to be undefined.
I see a message like this:
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/whatwg-fetch/fetch.js
2: return self
3: // eslint-disable-next-line no-invalid-this
4: })(typeof self !== 'undefined' ? self : this)
^
5: var support = {
6: searchParams: 'URLSearchParams' in global,
I'm using Rollup to bundle a polyfill for older browsers.
FWIW, this is the globalThis fallback chain that babel adds to my code any time I use global.
The warning is nothing to worry about, all browsers have a global variable named self, which is what is used first, the fallback to this is only for non-browser environments such as NodeJS, where likely a bundler is not being used.
Version 3.2.0 includes a fix for "global" in node environments. Recent versions of rollup enforce a "no top-level this" rule and forces
this
to beundefined
.I see a message like this:
I'm using Rollup to bundle a polyfill for older browsers.
FWIW, this is the
globalThis
fallback chain that babel adds to my code any time I useglobal
.I believe that babel just uses whatever
cores-js
does forglobalThis
The text was updated successfully, but these errors were encountered: