-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.serve.js
43 lines (41 loc) · 910 Bytes
/
webpack.serve.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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ASSET_PATH = `${process.env.PUBLIC_PATH || ''}/`;
console.log(ASSET_PATH);
/**
* @type { import("webpack").Configuration }
*/
module.exports = {
entry: './index.js',
devServer: {
port: 8081,
static: {
directory: path.join(__dirname, 'public')
},
client: {
overlay: false,
}
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
publicPath: ASSET_PATH
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: 'body',
templateParameters: {
ga: ASSET_PATH !== '/'
}
}),
new webpack.DefinePlugin({
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH),
}),
],
experiments: {
futureDefaults: true,
},
mode: 'development',
};