-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathwebpack.prod.js
53 lines (52 loc) · 1.06 KB
/
webpack.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const { merge } = require( 'webpack-merge' );
const common = require( './webpack.config.js' );
const CssMinimizerPlugin = require( 'css-minimizer-webpack-plugin' );
const ImageminPlugin = require( 'imagemin-webpack-plugin' ).default;
/**
* Webpack config (Production mode)
*
* @see https://webpack.js.org/guides/production/
*/
module.exports = merge( common, {
plugins: [
/**
* Uses Imagemin to compress source images.
*
* @see https://www.npmjs.com/package/imagemin-webpack-plugin
*/
new ImageminPlugin( {
disable: false,
test: /\.(jpe?g|png|gif|svg)$/i,
gifsicle: {
interlaced: true,
},
optipng: {
optimizationLevel: 3,
},
jpegtran: {
quality: 70,
progressive: true,
},
svgo: null,
} ),
],
optimization: {
minimizer: [
/**
* Minify CSS.
*
* @see https://www.npmjs.com/package/css-minimizer-webpack-plugin
*/
new CssMinimizerPlugin( {
minimizerOptions: {
preset: [
'default',
{
discardComments: { removeAll: true },
},
],
},
} ),
],
},
} );