Skip to content

Commit f2f15c0

Browse files
clydinalan-agius4
authored andcommitted
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.
1 parent 2e4ee28 commit f2f15c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ function initializeNgccProcessor(
6666
const errors: string[] = [];
6767
const warnings: string[] = [];
6868
const resolver = compiler.resolverFactory.get('normal', {
69+
// Caching must be disabled because it causes the resolver to become async after a rebuild
70+
cache: false,
6971
extensions: ['.json'],
7072
useSyncFileSystemCalls: true,
7173
});

0 commit comments

Comments
 (0)