initial commit
This commit is contained in:
43
webpack/config.js
Normal file
43
webpack/config.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import { join } from "path";
|
||||
|
||||
const port = process.env.PORT || 5005;
|
||||
const devServerHost = "127.0.0.1";
|
||||
const devServerUrl = `http://${devServerHost}:${port}/`;
|
||||
|
||||
const Environment = {
|
||||
development: "development",
|
||||
production: "production",
|
||||
};
|
||||
const environment = process.env.NODE_ENV || Environment.production;
|
||||
|
||||
const EnvironmentConfig = {
|
||||
development: "development",
|
||||
nonprod: "nonprod",
|
||||
prelive: "prelive",
|
||||
production: "production",
|
||||
};
|
||||
const environmentConfiguration = process.env.ENV_CONFIGURATION || EnvironmentConfig.development;
|
||||
|
||||
const isProd = environmentConfiguration === EnvironmentConfig.production;
|
||||
const isPrelive = environmentConfiguration === EnvironmentConfig.prelive;
|
||||
const isNonprod = environmentConfiguration === EnvironmentConfig.nonprod;
|
||||
const isDev = environment === Environment.development
|
||||
&& environmentConfiguration === EnvironmentConfig.development;
|
||||
|
||||
export default {
|
||||
environment,
|
||||
environmentConfiguration,
|
||||
isProd,
|
||||
isNonprod,
|
||||
isDev,
|
||||
isPrelive,
|
||||
devServer: {
|
||||
isDevServer: process.env.WEBPACK_IS_DEV_SERVER === "true",
|
||||
host: devServerHost,
|
||||
url: devServerUrl,
|
||||
},
|
||||
webpack: {
|
||||
rootDir: join(__dirname, "../"),
|
||||
},
|
||||
};
|
||||
export { EnvironmentConfig };
|
||||
Reference in New Issue
Block a user