-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.prod.js
47 lines (46 loc) · 1.21 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
const TerserWebackPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
module.exports = {
// devtool: false,
target: 'browserslist',
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin(),
new ESLintPlugin({
emitError: true,
}),
],
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader],
},
],
},
optimization: {
minimizer: [new TerserWebackPlugin(), new CssMinimizerPlugin()],
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name({ context }) {
if (context) {
const [, name] =
/[\\/]node_modules(?:\\.pnpm)?[\\/](.*?)(?:[\\/]|$)/.exec(context) || [];
return name.replace('@', '');
}
return null;
},
},
},
},
},
};