forked from influxdata/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.ts
75 lines (73 loc) · 1.82 KB
/
webpack.dev.ts
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
export {}
const path = require('path')
const merge = require('webpack-merge')
const common = require('./webpack.common.ts')
const PORT = parseInt(process.env.PORT, 10) || 8080
const PUBLIC = process.env.PUBLIC || undefined
const {BASE_PATH} = require('./src/utils/env')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const webpack = require('webpack')
module.exports = merge(common, {
mode: 'development',
devtool: 'cheap-inline-source-map',
output: {
path: path.join(__dirname, 'build'),
filename: '[name].js',
},
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
},
devServer: {
hot: true,
historyApiFallback: true,
proxy: {
'/api/v2': 'http://localhost:8086',
'/debug/flush': 'http://localhost:8086',
'/oauth': 'http://localhost:8086',
'/health': 'http://localhost:8086',
},
allowedHosts: 'all',
host: '0.0.0.0',
port: PORT,
devMiddleware: {
publicPath: PUBLIC,
},
webSocketServer: {
options: {
path: `${BASE_PATH}hmr`,
},
},
client: {
progress: false,
overlay: {
errors: true,
warnings: false,
},
webSocketURL: {
hostname: '0.0.0.0',
pathname: `${BASE_PATH}hmr`,
port: 443,
},
},
},
plugins: [
new ForkTsCheckerWebpackPlugin({
async: true,
logger: {
devServer: false, // don't block UI compilation on TS errors
},
}),
new webpack.DllReferencePlugin({
context: path.join(__dirname, 'build'),
manifest: require('./build/vendor-manifest.json'),
}),
new BundleAnalyzerPlugin({
analyzerHost: '0.0.0.0',
analyzerPort: '9997',
openAnalyzer: false,
}),
],
})