forked from PeerJ/slamscan
-
Notifications
You must be signed in to change notification settings - Fork 2
/
util.js
29 lines (25 loc) · 842 Bytes
/
util.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
const productionEnvs = ["production", "deploy"];
const isNodeEnvDevelopment = !productionEnvs.includes(process.env.NODE_ENV);
const isBabelEnvDevelopment = process.env.BABEL_ENV !== undefined
? !productionEnvs.includes(process.env.BABEL_ENV)
: isNodeEnvDevelopment;
const isDevelopment = isNodeEnvDevelopment && isBabelEnvDevelopment;
const WEBPACK_MODE_PRODUCTION = "production";
const WEBPACK_MODE_DEVELOPMENT = "development";
const resolveWebpackMode = () => {
if (isDevelopment) {
return WEBPACK_MODE_DEVELOPMENT;
}
return WEBPACK_MODE_PRODUCTION;
};
const webpackMode = resolveWebpackMode();
module.exports = {
WEBPACK_MODE_PRODUCTION,
WEBPACK_MODE_DEVELOPMENT,
productionEnvs,
isDevelopment,
isNodeEnvDevelopment,
isBabelEnvDevelopment,
resolveWebpackMode,
webpackMode
};