Return early if no modified assets

This commit is contained in:
emizzle 2018-10-19 16:03:56 +11:00 committed by Pascal Precht
parent 5b1a226885
commit 3437f80a89
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 10 additions and 12 deletions

View File

@ -86,7 +86,7 @@ class Pipeline {
function shouldRunWebpack(next){
// assuming we got here because an asset was changed, let's check our webpack config
// to see if the changed asset requires webpack to run
if(modifiedAssets || modifiedAssets.length) {
if(!(modifiedAssets && modifiedAssets.length)) return next(null, false);
const configReader = new WebpackConfigReader({webpackConfigName: self.webpackConfigName});
return configReader.readConfig((err, config) => {
if(err) return next(err);
@ -98,8 +98,6 @@ class Pipeline {
const shouldRun = modifiedAssets.some(modifiedAsset => config.module.rules.some(rule => rule.test.test(modifiedAsset)));
return next(null, !shouldRun);
});
}
next(null, false);
},
function runWebpack(shouldNotRun, next) {
if(shouldNotRun) return next();