Skip to content

Commit

Permalink
fix(@ngtools/webpack): disable caching for ngcc synchronous Webpack r…
Browse files Browse the repository at this point in the history
…esolver

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.
  • Loading branch information
clydin authored and alan-agius4 committed Jun 10, 2021
1 parent 2e4ee28 commit f2f15c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ngtools/webpack/src/ivy/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit f2f15c0

Please sign in to comment.