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