Closed
Description
- https://github.com/github/fetch/releases/tag/v3.2.0
- Fix https://github.com/github/fetch/issues/657 #794
- https://github.com/github/fetch/pull/794/files#diff-37e6c8c3d38d10cb0fc896766eb1b692R4
- https://rollupjs.org/guide/en/#error-this-is-undefined
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
.
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
I believe that babel just uses whatever cores-js
does for globalThis
Metadata
Assignees
Labels
No labels
Activity