-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.mjs
54 lines (52 loc) · 1.19 KB
/
webpack.config.mjs
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
import {createRequire} from 'module';
const require = createRequire(import.meta.url);
const ASSET_PATH = process.env.ASSET_PATH || '/';
export default () => /**@type {import('webpack').Configuration}*/({
output: {
filename: '[name].[contenthash].js',
publicPath: ASSET_PATH
},
devServer: {
allowedHosts: 'all',
hot: false,
client: {
logging: 'warn'
},
},
module: {
rules: [
{
test: /\.(j|t)s(x)?$/,
loader: require.resolve('babel-loader')
},
{
test: /\.css$/,
use: [
{
loader: require.resolve('style-loader')
},
{
loader: require.resolve('css-loader'),
options: {
modules: {
auto: true,
localIdentName: '[local]--[hash:base64:5]'
}
}
}
]
}
]
},
resolve: {
extensions: ['', '.js', '.json', '.wasm', '.tsx', '.ts'],
},
plugins: [
new (require('webpack').DefinePlugin)({
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH)
}),
new (require('html-webpack-plugin'))({
template: require.resolve('./index.html')
})
]
});