webpack.config.js 500 B

1234567891011121314
  1. const commonConfig = require("./build-utils/webpack.common");
  2. const webpackMerge = require("webpack-merge");
  3. const defaultEnv = { env: "prod" };
  4. // Export a function returning config instead of a static config.
  5. // The purpose is to allow use of the environment.
  6. module.exports = (env = defaultEnv) => {
  7. const envConfig = require(`./build-utils/webpack.${env.env}`);
  8. // The latter overwrites (merges into) the former.
  9. const config = webpackMerge(commonConfig, envConfig);
  10. return config;
  11. };