chore(deps): upgrade to webpack@^5, add stream polyfill

This commit is contained in:
Christopher Willis-Ford 2024-01-18 13:03:34 -08:00
parent 678ad55ab6
commit 0a37341084
3 changed files with 3307 additions and 1785 deletions

5077
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -142,12 +142,13 @@
"scratch-l10n": "3.18.0", "scratch-l10n": "3.18.0",
"selenium-webdriver": "4.1.0", "selenium-webdriver": "4.1.0",
"slick-carousel": "1.6.0", "slick-carousel": "1.6.0",
"stream-browserify": "3.0.0",
"style-loader": "0.12.3", "style-loader": "0.12.3",
"tap": "14.11.0", "tap": "14.11.0",
"url-loader": "3.0.0", "url-loader": "3.0.0",
"webpack": "4.47.0", "webpack": "5.89.0",
"webpack-bundle-analyzer": "4.10.1", "webpack-bundle-analyzer": "4.10.1",
"webpack-cli": "3.3.12", "webpack-cli": "5.1.4",
"webpack-dev-middleware": "5.3.1", "webpack-dev-middleware": "5.3.1",
"xhr": "2.2.0" "xhr": "2.2.0"
}, },

View file

@ -98,7 +98,7 @@ class HtmlWebpackBackwardsCompatibilityPlugin {
// Config // Config
module.exports = { module.exports = {
entry: entry, entry: entry,
devtool: process.env.NODE_ENV === 'production' ? 'none' : 'eval', devtool: process.env.NODE_ENV === 'production' ? false : 'eval',
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
output: { output: {
path: path.resolve(__dirname, 'build'), path: path.resolve(__dirname, 'build'),
@ -106,6 +106,10 @@ module.exports = {
publicPath: '/' publicPath: '/'
}, },
resolve: { resolve: {
fallback: {
// jszip uses Node's `stream` module, which is no longer polyfilled by default in Webpack 5
stream: require.resolve('stream-browserify')
},
symlinks: false // Fix local development with `npm link` packages symlinks: false // Fix local development with `npm link` packages
}, },
module: { module: {
@ -172,15 +176,13 @@ module.exports = {
], ],
noParse: /node_modules\/google-libphonenumber\/dist/ noParse: /node_modules\/google-libphonenumber\/dist/
}, },
node: {
fs: 'empty'
},
optimization: { optimization: {
splitChunks: { splitChunks: {
cacheGroups: { cacheGroups: {
common: { common: {
chunks: 'all', chunks: 'all',
name: 'common', name: 'common',
minSize: 1024,
minChunks: pageRoutes.length // Extract only chunks common to all html pages minChunks: pageRoutes.length // Extract only chunks common to all html pages
} }
} }