Skip to content

Instantly share code, notes, and snippets.

@drwpow
Last active May 4, 2018 15:22
Show Gist options
  • Save drwpow/dea6347ae6415b82da47e5d811807401 to your computer and use it in GitHub Desktop.
Save drwpow/dea6347ae6415b82da47e5d811807401 to your computer and use it in GitHub Desktop.
module.exports = {
webpack: (config, options) =>
Object.assign(config, {
plugins: config.plugins.concat([
new webpack.ProvidePlugin(
config.isServer
? {}
: { fetch: 'imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch' }
),
]),
resolve: Object.assign(config.resolve, {
alias: Object.assign(
config.resolve.alias,
config.isServer ? {} : { fetch: 'node-fetch' }
),
}),
}),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment