-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade webpack@5 to fix CI builds #6509
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); | ||
const FriendlyErrorsWebpackPlugin = require('@soda/friendly-errors-webpack-plugin'); | ||
const { flatMap } = require('lodash'); | ||
|
||
const { toGlobalName, externals } = require('./externals'); | ||
|
@@ -44,8 +44,21 @@ function rules() { | |
|
||
function plugins() { | ||
return { | ||
ignoreEsprima: () => new webpack.IgnorePlugin(/^esprima$/, /js-yaml/), | ||
ignoreMomentOptionalDeps: () => new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), | ||
ignoreEsprima: () => | ||
new webpack.IgnorePlugin({ | ||
resourceRegExp: /^esprima$/, | ||
contextRegExp: /js-yaml/, | ||
}), | ||
ignoreMomentOptionalDeps: () => | ||
new webpack.IgnorePlugin({ | ||
resourceRegExp: /^\.\/locale$/, | ||
contextRegExp: /moment$/, | ||
}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The syntax for IgnorePlugin changed (new documentation):
|
||
includePolyfills: () => | ||
new webpack.ProvidePlugin({ | ||
Buffer: ['buffer', 'Buffer'], | ||
process: 'process', | ||
}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webpack 5 no longer includes automatic polyfills for Node.js:
This (and the below |
||
friendlyErrors: () => new FriendlyErrorsWebpackPlugin(), | ||
}; | ||
} | ||
|
@@ -129,6 +142,12 @@ function baseConfig({ target = isProduction ? 'umd' : 'umddir' } = {}) { | |
alias: { | ||
moment$: 'moment/moment.js', | ||
}, | ||
fallback: { | ||
buffer: require.resolve('buffer'), | ||
path: require.resolve('path-browserify'), | ||
process: require.resolve('process'), | ||
stream: require.resolve('stream-browserify'), | ||
}, | ||
}, | ||
plugins: Object.values(plugins()).map(plugin => plugin()), | ||
devtool: isTest ? '' : 'source-map', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
friendly-errors-webpack-plugin
does not supportwebpack@5
and is archived on GitHub.@soda/friendly-errors-webpack-plugin
is a fork which supportswebpack@5
.