-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
50 lines (49 loc) · 1.03 KB
/
webpack.common.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
entry: ['./src/index'],
output: {
path: path.join(__dirname, 'build'),
filename: '[name].[contenthash].js',
publicPath: '/',
clean: true
},
plugins: [
new Dotenv({
systemvars: true
}),
new HtmlWebpackPlugin({
template: './index.html'
})
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve(__dirname, 'src'), 'node_modules']
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|svg|jpg|gif|woff(2)?|ttf|eot)$/,
type: 'asset/resource'
}
]
},
optimization: {
moduleIds: 'deterministic',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
}
};