forked from microsoft/fuse-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.devserver.js
More file actions
40 lines (39 loc) · 1.1 KB
/
Copy pathwebpack.devserver.js
File metadata and controls
40 lines (39 loc) · 1.1 KB
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
devServer: (name, version, apiServerHost, port) => {
return {
contentBase: path.resolve(`../built/${version}`),
compress: true,
inline: true,
port: port || 3006,
historyApiFallback: {
index: `../built/${version}/${name}.debug.html`,
rewrites: [
// to to home page for single page app
{ from: /^.*\/[^\.\/]*$/, to: `./${name}.debug.html` },
{ from: /developers\/.*$/, to: `./${name}.debug.html` }
]
},
proxy: {
'/api': {
target: `https://${apiServerHost}`,
secure: false,
debug: true,
changeOrigin: true
}
}
};
},
plugins: (name, version) => [
new webpack.DefinePlugin({
'BASENAME': JSON.stringify('/'),
'VERSION': JSON.stringify(version)
}),
new HtmlWebpackPlugin({
template: '../index.webpack-devserver.html',
inject: 'body',
filename: `./${name}.debug.html`
})]
}