-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
57 lines (54 loc) · 1.22 KB
/
webpack.config.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
var path = require('path');
var SRC_DIR = path.join(__dirname, '/client/src');
var DIST_DIR = path.join(__dirname, '/client/dist');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const zlib = require('zlib');
module.exports = {
entry: [`${SRC_DIR}/index.jsx`],
output: {
filename: 'bundle.js',
path: DIST_DIR
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
}),
new CompressionPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg)$/,
compressionOptions: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 11
}
},
threshold: 10240,
minRatio: 0.8,
deleteOriginalAssets: false
})
],
module: {
rules: [
{
test: /\.jsx?/,
exclude: /node_modules/,
use: { loader: 'babel-loader' }
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
use: { loader: 'url-loader' }
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader']
}
]
},
optimization: {
usedExports: true,
minimizer: [new CssMinimizerPlugin()]
}
};