-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
74 lines (68 loc) · 1.66 KB
/
webpack.dev.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
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
const { merge } = require("webpack-merge");
const common = require("./webpack.common.js");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
const config = require("config");
let webpackConfig = merge(common, {
mode: "development",
devtool: "eval-source-map",
entry: {
reactsample: "./src/sample-react-app.jsx",
},
module: {
rules: [
{
test: /\.html$/,
use: [
{
loader: "html-loader",
},
],
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html",
chunks: [],
}),
new HtmlWebPackPlugin({
template: "./src/index-bootstrap4.html",
filename: "./index-bootstrap4.html",
chunks: ["bootstrap4"],
}),
new HtmlWebPackPlugin({
template: "./src/index-plain.html",
filename: "./index-plain.html",
chunks: ["plain"],
}),
new HtmlWebPackPlugin({
template: "./src/index-reactsample.html",
filename: "./index-reactsample.html",
chunks: ["reactsample"],
}),
],
});
if (
typeof config.startupapiDevProxy !== "undefined" &&
config.startupapiDevProxy
) {
console.log(
`[Startup API] Will proxy requests from '/users/ to ${config.startupapiDevProxy}`
);
webpackConfig = merge(webpackConfig, {
devServer: {
proxy: {
"/users": {
target: config.startupapiDevProxy,
pathRewrite: { "^/users/": "/" },
secure: false,
changeOrigin: true,
},
},
},
});
}
module.exports = webpackConfig;