chore: update webpack config to v5
This commit is contained in:
parent
5cda939329
commit
d5b0063d72
@ -126,26 +126,15 @@ async function webpackConfig() {
|
||||
chunkFilename: '[chunkhash].css',
|
||||
ignoreOrder: false, // Enable to remove warnings about conflicting order
|
||||
}),
|
||||
new webpack.NamedChunksPlugin((chunk) => {
|
||||
if (chunk.name) {
|
||||
return chunk.name;
|
||||
}
|
||||
let modules = chunk.modules || [chunk.entryModule];
|
||||
return modules.map(m => path.relative(m.context, m.request)).join("_");
|
||||
}),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
new ManifestPlugin({
|
||||
fileName: path.resolve(__dirname, 'config', 'webpack.yml'),
|
||||
publicPath: `wp-${webpackVersion}/`,
|
||||
generate: (seed, files, entrypoints) => Object.keys(entrypoints).reduce((acc, fs) => ({...acc, [fs]: files.filter(file => entrypoints[fs].filter(basename => !(/\.map$/.test(basename))).some(basename => file.path.endsWith(basename))).filter(file => file.isInitial).map(file => file.path)}), {}),
|
||||
serialize: yaml.safeDump
|
||||
}),
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: [ path.resolve(__dirname, 'static'),
|
||||
path.resolve(__dirname, 'well-known'),
|
||||
]
|
||||
}),
|
||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||
new webpack.IgnorePlugin({
|
||||
resourceRegExp: /^\.\/locale$/,
|
||||
contextRegExp: /moment$/
|
||||
}),
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{ from: 'assets/lmu/sigillum.svg', to: path.resolve(__dirname, 'static', 'img/lmu/sigillum.svg') },
|
||||
@ -282,9 +271,10 @@ async function webpackConfig() {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: true
|
||||
terserOptions: {
|
||||
sourceMap: true
|
||||
}
|
||||
}),
|
||||
new OptimizeCSSAssetsPlugin({
|
||||
cssProcessorOptions: {
|
||||
@ -294,6 +284,8 @@ async function webpackConfig() {
|
||||
}
|
||||
})
|
||||
],
|
||||
moduleIds: 'named',
|
||||
chunkIds: 'named',
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
@ -321,7 +313,6 @@ async function webpackConfig() {
|
||||
}
|
||||
}
|
||||
},
|
||||
moduleIds: 'hashed'
|
||||
},
|
||||
|
||||
mode: 'production',
|
||||
|
||||
Reference in New Issue
Block a user