-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
49 lines (47 loc) · 1.18 KB
/
webpack.prod.js
File metadata and controls
49 lines (47 loc) · 1.18 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
47
48
49
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const merge = require('webpack-merge');
const common = require('./webpack.config');
const BUILD_DIR = path.resolve(__dirname, 'dist');
module.exports = merge(common, {
output: {
path: BUILD_DIR,
filename: 'bundle.[hash].js',
chunkFilename: '[name].[hash].chunk.js',
},
mode: 'production',
module: {
rules: [
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'eslint-loader',
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
],
},
plugins: [
new CleanWebpackPlugin([BUILD_DIR]),
new MiniCssExtractPlugin({
filename: 'bundle.[hash].css',
}),
new CompressionPlugin({
algorithm: 'gzip',
test: /\.jsx?$|\.s?css$/,
minRatio: 0.8,
}),
],
performance: {
hints: 'warning',
},
});