Ich habe zwei Konfigurationen für Webpack erstellt.webpack watch option während multi config
Wenn ich ein Array von Konfigurationen exportieren: alles funktioniert, anstelle der Option beobachten. Die Aufgaben enden einfach (mit Erfolg).
Wenn ich eine Konfigurationsexport testen - Uhr funktioniert gut.
Ich habe mehrere Einstiegspunkte ausprobiert, und sah auch gut funktioniert diese Zeit, aber Config sah ein wenig unordentlich aus.
Ich werde meine Configs, hoffe auf Ratschläge, danke.
/* FRONT-END CONFIG */
var frontWebpackConfig = {
entry: "./src/front/app",
output: {
path: __dirname + "/build",
filename: "public/app.js"
},
watch: NODE_ENV == "development",
watchOptions : {
aggregateTimeout: 100
},
devtool : NODE_ENV == "development" ? "cheap-inline-module-source-map" : null,
plugins : [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
NODE_ENV : JSON.stringify(NODE_ENV)
})
],
module : {
loaders : [
{
test : /\.js$/,
loader : 'babel',
query: {
presets: ['es2015']
}
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
}
};
/* BACK-END CONFIG */
var backWebpackConfig = {
entry: "./src/back/server",
target : 'node',
output: {
path: __dirname + "/build",
filename: "server.js"
},
externals: nodeModules,
watch: NODE_ENV == "development",
watchOptions : {
aggregateTimeout: 100
},
devtool : NODE_ENV == "development" ? "cheap-inline-module-source-map" : null,
plugins : [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
NODE_ENV : JSON.stringify(NODE_ENV)
})
],
module : {
loaders : [
{
test : /\.js$/,
loader : 'babel',
query: {
presets: ['es2015']
}
}
]
}
}
/* EXPORTS */
module.exports = [frontWebpackConfig, backWebpackConfig]
Auch ich habe diese Ausdrücke cheked: „NODE_ENV ==‚Entwicklung‘“ Wert und versuchte wahr direkt einzustellen.
Update: lustige Sache, ich habe gerade versucht, mit "--watch" -Option in der Befehlszeile zu starten und es hat gut funktioniert. Irgendwelche Ideen warum Dateikonfiguration nicht funktioniert?