'webpack AngularCompilerPlugin hostReplacementPaths in angular 13 doesn't work

After I've upgraded angular from v11 to v13 I found that I can't use hostReplacements from the AngularCompilerPlugin

const angularCompilerPlugin = config.plugins.find((plugin) => plugin instanceof AngularCompilerPlugin);

if (angularCompilerPlugin) {
  const { hostReplacementPaths } = angularCompilerPlugin._options;
  hostReplacementPaths[filePath] = newFilePath;

It's not allowed anymore I assume that AngularCompilerPlugin should be replaced with AngularWebpackPlugin but not sure how to replace multiple files

Please let me know if there are other approaches to replace files with diff extensions



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source