Skip to content

Commit

Permalink
Upgrade to Webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Aug 4, 2022
1 parent 587ec89 commit f8393b6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

const mode = process.env.NODE_ENV || 'development';
const minimize = mode === 'production';
const plugins = [];

if (mode === 'production') {
plugins.push(new OptimizeCSSAssetsPlugin({
cssProcessorOptions: {
discardComments: true,
map: {
inline: false
}
plugins.push(new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardComments: {removeAll: true},
map: {
inline: false,
},
},
],
},
}));
}
Expand Down

0 comments on commit f8393b6

Please sign in to comment.