-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
executable file
·71 lines (65 loc) · 1.61 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import { merge } from 'webpack-merge';
import TerserPlugin from 'terser-webpack-plugin';
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
import common from './webpack.common.js';
export default merge(common, {
mode: 'production',
devtool: false,
plugins: [
// Removes/cleans build folders and unused assets when rebuilding
new CleanWebpackPlugin(),
],
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/i,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 2,
sourceMap: false,
modules: false,
},
},
'postcss-loader',
'sass-loader',
],
},
],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true, // Removes console.logs from production code
},
format: {
comments: false, // Remove all comments
},
},
extractComments: false, // Prevents extracting comments into separate files
}),
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'default',
{
svgo: false, // Disable SVGO (inline scss issue)
},
],
},
}),
],
},
performance: {
hints: false,
maxEntrypointSize: 860000,
maxAssetSize: 860000,
},
});