forked from dvargas92495/roamjs-com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.development.config.js
48 lines (47 loc) · 1.23 KB
/
webpack.development.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 common = require("./webpack.config");
const webpack = require("webpack");
module.exports = (env) => {
const commonConfig = common(env);
commonConfig.module.rules.push({
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
});
if (env.WEBPACK_SERVE) {
const typescriptRule = commonConfig.module.rules.find((r) =>
r.test.test(".ts")
);
typescriptRule.use.unshift({ loader: "react-hot-loader/webpack" });
}
return {
...commonConfig,
mode: "development",
performance: {
hints: "error",
maxEntrypointSize: 13946000,
maxAssetSize: 13946000,
},
...(env.WEBPACK_SERVE
? {
output: {
...commonConfig.output,
publicPath: "http://localhost:8080/",
},
devServer: {
contentBase: "./build",
host: "127.0.0.1",
disableHostCheck: true,
hot: true,
publicPath: "http://localhost:8080/",
headers: {
"Access-Control-Allow-Origin": "https://roamresearch.com",
},
},
plugins: [
...commonConfig.plugins,
new webpack.HotModuleReplacementPlugin(),
],
}
: {}),
};
};