mirror of
https://github.com/scratchfoundation/scratch-storage.git
synced 2025-08-20 18:39:50 -04:00
refactor: use cross-fetch instead of node-fetch
Previously, we had Webpack's ProvidePlugin injecting `node-fetch` as a polyfill into Node builds, and web builds just relied on the `fetch` built into the browser (if it's there). Now, we use `cross-fetch` everywhere, and as a ponyfill instead of a polyfill. This broke the unit tests in `fetch-tool.js` because they were overriding `global.fetch` to mock `node-fetch`. Now, those tests use `tap.mock` to mock `cross-fetch`. Of course, `tap.mock` didn't exist in the old version of `node-tap`, so I also upgraded that.
This commit is contained in:
parent
aef954cb57
commit
fd6f3a166a
6 changed files with 6094 additions and 8222 deletions
|
@ -1,5 +1,4 @@
|
|||
const path = require('path');
|
||||
const {ProvidePlugin} = require('webpack');
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
|
||||
const base = {
|
||||
|
@ -65,11 +64,6 @@ module.exports = [
|
|||
'js-md5': true,
|
||||
'localforage': true,
|
||||
'text-encoding': true
|
||||
},
|
||||
plugins: [
|
||||
new ProvidePlugin({
|
||||
fetch: ['node-fetch', 'default']
|
||||
})
|
||||
]
|
||||
}
|
||||
})
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue