Skip to content

Commit

Permalink
Use existing fetch if it exists, otherwise fallback to whatwg-fetch
Browse files Browse the repository at this point in the history
I'm not sure why the code was written the way it is, but it appears to be forcing the polyfill to be used even in environments where the Fetch API exists natively, which isn't intentional and causes the bugs described in lquixada#91, lquixada#78, and lquixada#69.

The original commit and PR don't describe why the behaviour was changed: lquixada@123b1a2
  • Loading branch information
ThisIsMissEm authored and bahlo committed Jun 3, 2022
1 parent 24dedb4 commit c6f2c35
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export default [
delete __self__.fetch.polyfill;
// Choose between native implementation (global) or custom implementation (__self__)
// var ctx = global.fetch ? global : __self__;
var ctx = __self__; // this line disable service worker support temporarily
var ctx = global.fetch ? global : __self__;
exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
exports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.
Expand Down

0 comments on commit c6f2c35

Please sign in to comment.