improve (minifation): improve minification at compile time

This commit is contained in:
Mickael Kerjean
2019-05-09 16:35:24 +10:00
parent 3899e26a81
commit d85bb41620
2 changed files with 11 additions and 4 deletions

View File

@ -32,14 +32,14 @@
"css-loader": "^0.28.10", "css-loader": "^0.28.10",
"exif-js": "^2.3.0", "exif-js": "^2.3.0",
"html-loader": "^0.4.5", "html-loader": "^0.4.5",
"html-webpack-plugin": "^2.28.0", "html-webpack-plugin": "^3.2.0",
"node-sass": "^4.10.0", "node-sass": "^4.10.0",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
"react": "^15.6.2", "react": "^15.6.2",
"react-dom": "^15.6.2",
"react-addons-css-transition-group": "^15.6.2", "react-addons-css-transition-group": "^15.6.2",
"react-dnd": "^2.4.0", "react-dnd": "^2.4.0",
"react-dnd-html5-backend-filedrop": "^1.0.0", "react-dnd-html5-backend-filedrop": "^1.0.0",
"react-dom": "^15.6.2",
"react-draggable": "^2.2.6", "react-draggable": "^2.2.6",
"react-infinite-scroller": "^1.1.4", "react-infinite-scroller": "^1.1.4",
"react-router": "^4.1.1", "react-router": "^4.1.1",

View File

@ -57,7 +57,13 @@ let config = {
new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.OccurrenceOrderPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.join(__dirname, 'client', 'index.html'), template: path.join(__dirname, 'client', 'index.html'),
inject: true inject: true,
minify: {
collapseWhitespace: true,
removeComments: true,
minifyJS: true,
minifyCSS: true,
}
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ from: 'manifest.json', to: "assets/" }, { from: 'manifest.json', to: "assets/" },
@ -73,7 +79,8 @@ let config = {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
config.plugins.push(new UglifyJSPlugin({ config.plugins.push(new UglifyJSPlugin({
sourceMap: false sourceMap: false,
extractComments: true,
})); }));
config.plugins.push(new CompressionPlugin({ config.plugins.push(new CompressionPlugin({
asset: "[path].gz[query]", asset: "[path].gz[query]",