Skip to content

Commit c322a29

Browse files
committed
fix(@ngtools/webpack): remove use of Webpack 5 deprecated compilationDependencies
The `Compilation.compilationDependencies` property is now deprecated in Webpack 5. The `Compilation.fileDependencies` property is now used instead with Webpack 5.
1 parent 64ead7c commit c322a29

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/ngtools/webpack/src/ivy/plugin.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { TypeScriptPathsPlugin } from '../paths-plugin';
2020
import { WebpackResourceLoader } from '../resource_loader';
2121
import { forwardSlashPath } from '../utils';
2222
import { addError, addWarning } from '../webpack-diagnostics';
23-
import { mergeResolverMainFields } from '../webpack-version';
23+
import { isWebpackFiveOrHigher, mergeResolverMainFields } from '../webpack-version';
2424
import { DiagnosticsReporter, createDiagnosticsReporter } from './diagnostics';
2525
import {
2626
augmentHostWithCaching,
@@ -239,9 +239,15 @@ export class AngularWebpackPlugin {
239239
.filter((sourceFile) => !internalFiles?.has(sourceFile));
240240

241241
// Ensure all program files are considered part of the compilation and will be watched
242-
allProgramFiles.forEach((sourceFile) =>
243-
compilation.compilationDependencies.add(sourceFile.fileName),
244-
);
242+
if (isWebpackFiveOrHigher()) {
243+
allProgramFiles.forEach((sourceFile) =>
244+
compilation.fileDependencies.add(sourceFile.fileName),
245+
);
246+
} else {
247+
allProgramFiles.forEach((sourceFile) =>
248+
compilation.compilationDependencies.add(sourceFile.fileName),
249+
);
250+
}
245251

246252
compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
247253
// Rebuild any remaining AOT required modules

0 commit comments

Comments
 (0)