Skip to content

Commit

Permalink
Upgrade webpack, replace OptimizeCssAssetsPlugin with CssMinimizerPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk committed May 3, 2021
1 parent 3b5b54d commit 61537b4
Show file tree
Hide file tree
Showing 3 changed files with 669 additions and 2,291 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"mock:pagerduty_api": "mockserver -m test/mocks",
"build": "webpack --config webpack.dev.js",
"build:watch": "webpack --watch --config webpack.dev.js",
"build:prod": "NODE_ENV=production webpack --config webpack.prod.js --display-modules",
"build:prod": "NODE_ENV=production webpack --config webpack.prod.js",
"app": "node -r esm src/pagerbeauty.js",
"app:watch": "nodemon -r esm src/pagerbeauty.js",
"app:prod": "NODE_ENV=production node -r esm src/pagerbeauty.js",
Expand Down Expand Up @@ -65,6 +65,7 @@
"conventional-changelog-ember": "^2.0.9",
"core-js": "3",
"css-loader": "^5.2.4",
"css-minimizer-webpack-plugin": "^2.0.0",
"eslint": "^7.25.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-base": "^14.2.1",
Expand All @@ -78,7 +79,6 @@
"node-sass": "^4.12.0",
"nodemon": "^2.0.7",
"nyc": "^15.0.0",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"prop-types": "^15.7.2",
"puppeteer-core": "5.0.0",
"react": "^17.0.2",
Expand All @@ -89,8 +89,8 @@
"sinon-chai": "^3.6.0",
"style-loader": "^2.0.0",
"tap-xunit": "^2.4.1",
"webpack": "^4.33.0",
"webpack-cli": "^3.3.3",
"webpack": "^5.36.2",
"webpack-cli": "^4.6.0",
"webpack-merge": "^5.7.3"
},
"nodemonConfig": {
Expand Down
27 changes: 19 additions & 8 deletions webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
/* eslint-disable import/no-extraneous-dependencies */
const { merge } = require('webpack-merge');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
/* eslint-enable */
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'production',
plugins: [
new OptimizeCssAssetsPlugin({
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
},
}),
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
}),
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardComments: { removeAll: true },
},
],
},
}),
],
},
output: {
path: `${__dirname}/assets/dist-prod`,
},
Expand Down
Loading

0 comments on commit 61537b4

Please sign in to comment.