generated from maksimr/playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
48 lines (47 loc) · 1.05 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
const ASSET_PATH = process.env.ASSET_PATH || '';
/**
* @typedef {import('webpack').Configuration & {devServer?: import('webpack').WebpackOptionsNormalized['devServer']}} WebpackConfig
* @returns {WebpackConfig}
*/
module.exports = () => ({
output: {
filename: '[name].[contenthash].js',
publicPath: ASSET_PATH
},
module: {
rules: [
{
test: /\.js(x)?$/,
loader: require.resolve('babel-loader')
},
{
test: /\.css$/,
use: [
{
loader: require.resolve('css-loader'),
options: {
modules: {
localIdentName: '[local]--[hash:base64:5]'
}
}
}
]
}
]
},
plugins: [
new (require('webpack').DefinePlugin)({
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH)
}),
new (require('html-webpack-plugin'))({
template: require.resolve('./index.html')
})
],
devServer: {
allowedHosts: 'all'
},
stats: 'minimal',
infrastructureLogging: {
level: 'warn',
}
});