-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
46 lines (45 loc) · 1.07 KB
/
Copy pathwebpack.prod.js
File metadata and controls
46 lines (45 loc) · 1.07 KB
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
const OptimizerCSSAssetWebpackPlugin = require("optimize-css-assets-webpack-plugin");
const TerserWebpackPlugin = require("terser-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
const { resolve } = require("path");
module.exports = merge(common, {
mode: "production",
optimization: {
minimizer: [
new OptimizerCSSAssetWebpackPlugin(),
new TerserWebpackPlugin({
terserOptions: {
compress: {
drop_console: true,
},
},
}),
],
splitChunks: {
chunks: "all",
},
},
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
],
},
plugins: [
new MiniCssExtractPlugin({ filename: `[name].css` }),
new HtmlWebpackPlugin({
template: resolve(__dirname, "src/index.html"),
filename: "index.html",
minify: {
collapseWhitespace: true,
removeComments: true,
},
hash: true,
}),
],
});