-
Notifications
You must be signed in to change notification settings - Fork 593
/
webpack.config.js
54 lines (52 loc) · 1.28 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
'use strict';
const path = require('path');
const { ModuleMinifierPlugin } = require('@rushstack/webpack5-module-minifier-plugin');
const { WorkerPoolMinifier } = require('@rushstack/module-minifier');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'production',
module: {
rules: [
{
test: /\.png$/i,
type: 'asset/resource'
},
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader']
}
]
},
target: ['web', 'es2020'],
resolve: {
extensions: ['.js', '.jsx', '.json']
},
entry: {
'heft-test-A': path.join(__dirname, 'lib', 'indexA.js'),
'heft-test-B': path.join(__dirname, 'lib', 'indexB.js')
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]_[contenthash].js',
chunkFilename: '[id].[name]_[contenthash].js',
assetModuleFilename: '[name]_[contenthash][ext][query]'
},
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [
new ModuleMinifierPlugin({
minifier: new WorkerPoolMinifier({
terserOptions: {
ecma: 2020,
mangle: true
},
verbose: true
}),
sourceMap: true
})
]
},
plugins: [new HtmlWebpackPlugin()]
};