fix(@ngtools/webpack): correctly create Webpack5 file watcher

This commit is contained in:
Charles Lyding 2020-10-13 10:41:40 -04:00 committed by Filipe Silva
parent dbaf92386d
commit 2fa17219d1
2 changed files with 4 additions and 2 deletions

View File

@ -295,5 +295,6 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
}; };
} }
watch = isWebpackFiveOrHigher() ? this.createWebpack5Watch : this.createWebpack4Watch(); // tslint:disable-next-line: no-any
watch = isWebpackFiveOrHigher() ? this.createWebpack5Watch() : this.createWebpack4Watch() as any;
} }

View File

@ -49,7 +49,8 @@ export default function() {
// Count the bundles. // Count the bundles.
.then((results) => { .then((results) => {
const stdout = results[0].stdout; const stdout = results[0].stdout;
if (!/(lazy-module|0)\.js/g.test(stdout)) { // First regexp is for Webpack 4; Second is for Webpack 5
if (!/(lazy-module|0)\.js/g.test(stdout) && !/lazy_module_ts\.js/g.test(stdout)) {
throw new Error('Expected webpack to create a new chunk, but did not.'); throw new Error('Expected webpack to create a new chunk, but did not.');
} }
}) })