-
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathwebpack.prod.js
44 lines (41 loc) · 1002 Bytes
/
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
const TerserPlugin = require('terser-webpack-plugin');
const { merge } = require('webpack-merge');
const common = require('./webpack.config.js');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const config = merge(common, {
entry: {
'frontend/ajax-load-more': './src/frontend/js/ajax-load-more.js',
'frontend/ajax-load-more.min': './src/frontend/js/ajax-load-more.js',
'admin/index': './src/admin/js/index.js',
},
optimization: {
minimize: true,
minimizer: [
/**
* Minify JS.
*
* @see https://webpack.js.org/plugins/terser-webpack-plugin/
*/
new TerserPlugin({
extractComments: false,
test: /\.min.js(\?.*)?$/i,
}),
/**
* Minify CSS.
*
* @see https://webpack.js.org/plugins/css-minimizer-webpack-plugin/
*/
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
discardComments: { removeAll: true },
},
],
},
}),
],
},
});
module.exports = config;