-
Notifications
You must be signed in to change notification settings - Fork 100
/
webpack.config.js
47 lines (40 loc) · 1.29 KB
/
webpack.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
// Workaround for Windows Based Development/Build
try {
require("os").networkInterfaces();
} catch (e) {
require("os").networkInterfaces = () => ({});
}
const baseConfig = require("./config/webpack.common.config");
const webpack = require("webpack");
const merge = require("webpack-merge");
const GitRevisionPlugin = require("git-revision-webpack-plugin");
const gitRevisionPlugin = new GitRevisionPlugin();
let config = merge(baseConfig, {
plugins: [
new webpack.DefinePlugin({
"process.env": {
CURRENT_BRANCH: JSON.stringify(gitRevisionPlugin.branch())
}
}),
new GitRevisionPlugin({
branch: true
})
]
});
// DEVELOPMENT CONFIG
if (!process.env.DEBUG_BUILD && process.env.NODE_ENV === "development") {
config = merge(config, { devtool: "eval-source-map" });
// PRODUCTION DEBUG CONFIG (unminified build + more specific source maps + no hot reload)
} else if (process.env.DEBUG_BUILD && process.env.NODE_ENV === "development") {
// get network name like 'rinkeby' or 'clique' to set environment for UI
console.log(`Using development config file ${process.env.ETHEREUM_NETWORK}`);
config = merge(config, {
devtool: "eval-source-map"
});
// PRODUCTION CONFIG
} else {
config = merge(config, {
mode: "production"
});
}
module.exports = config;