Skip to content

Propose to update Webpack5 configuration #133

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions create/templates/generate-webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ module.exports = (options) => {
path: resolvePath('www'),
`)}
filename: 'js/[name]${hashName}.js',
chunkFilename: 'js/[name]${hashName}.js',
publicPath: '',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json',
},
resolve: {
extensions: ${resolveExtensions},
Expand All @@ -105,7 +102,28 @@ module.exports = (options) => {
},
optimization: {
concatenateModules: true,
minimizer: [new TerserPlugin()],
minimizer: [
new TerserPlugin({
extractComments: {
// Webpack5 seems not to extract license information separately
condition: /^\**!|LICENSE|@preserve|@cc_on/i,
}
}),
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardUnused: true,
// Otherwise, license information will be removed unexpectedly
discardComments: {
remove: (comment) => !comment.match(/^\**!|LICENSE|@preserve|@cc_on/i)
},
},
],
},
}),
],
},
module: {
rules: [
Expand Down