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.
35 lines
900 B
JavaScript
35 lines
900 B
JavaScript
const merge = require('webpack-merge');
|
|
const path = require('path');
|
|
const common = require('./webpack.common.js');
|
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
|
const extractCSS = ExtractTextPlugin.extract({
|
|
fallback: "style-loader",
|
|
use: {
|
|
loader: "css-loader"
|
|
}
|
|
});
|
|
|
|
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: [configPath(env),
|
|
path.resolve(__dirname, 'src/index.jsx')]
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{ test: /\.css$/, use: extractCSS },
|
|
{ test: /\.js(x)?$/, exclude: /node_modules/, loader: "babel-loader?cacheDirectory=true" }
|
|
]
|
|
},
|
|
devtool: "eval-cheap-module-source-map",
|
|
devServer: {
|
|
contentBase: './dist'
|
|
},
|
|
});
|