fix(@ngtools/webpack): disable caching for ngcc synchronous Webpack resolver

The ngcc resolver must be synchronous to integrate with TypeScript which is only synchronous. If the Webpack resolver cache option is enabled when creating a resolver, the resolver will become asynchronous after a rebuild due to the internal implementation of the resolver caching. To prevent this change in behavior, caching is disabled for the ngcc resolver. The ngcc resolver is only used the first time each dependency is used by the application.
This commit is contained in:
Charles Lyding 2021-06-09 17:24:26 -04:00 committed by Alan Agius
parent 2e4ee282b3
commit f2f15c0893

View File

@ -66,6 +66,8 @@ function initializeNgccProcessor(
const errors: string[] = [];
const warnings: string[] = [];
const resolver = compiler.resolverFactory.get('normal', {
// Caching must be disabled because it causes the resolver to become async after a rebuild
cache: false,
extensions: ['.json'],
useSyncFileSystemCalls: true,
});