Files
react-template-esbuild/webpack/config.js
2025-09-18 19:02:11 +03:00

44 lines
1.2 KiB
JavaScript

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 };