Require the config as CLI arg for watch, build and production-build

The mqtt control map now loads the config provided via cli. It is no longer required to modify the src/config.js to load a different config.
This commit is contained in:
uwap 2018-02-02 07:45:00 +01:00
parent 3975518f6e
commit c7ca716802
8 changed files with 34 additions and 22 deletions

View file

@ -15,9 +15,17 @@ const extractCSS = ExtractTextPlugin.extract({
}
});
module.exports = merge(common, {
const configPath = env => {
if (env === true) {
throw "No config file was provided.";
}
return path.resolve(__dirname, `config/${env}`);
};
module.exports = env => merge(common, {
entry: {
main: path.resolve(__dirname, 'src/index.jsx'),
main: [configPath(env),
path.resolve(__dirname, 'src/index.jsx')]
vendor: ['react', 'material-ui', 'mqtt', 'lodash']
},
module: {