@@ -633,8 +633,9 @@ const unsafeCacheData = new WeakMap();
633633const dependencyReportCacheTokens = new WeakMap ( ) ;
634634
635635/**
636- * Modules known to have no dependency errors/warnings, per cache token.
637- * @type {WeakMap<DependencyReportCacheToken, WeakSet<Module>> }
636+ * Modules known to have no dependency errors/warnings, per cache token, with
637+ * the deferred requests they were checked with (`true` for none).
638+ * @type {WeakMap<DependencyReportCacheToken, WeakMap<Module, string | true>> }
638639 */
639640const modulesWithoutProblems = new WeakMap ( ) ;
640641
@@ -2969,6 +2970,18 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
29692970 } ) ;
29702971 }
29712972
2973+ /**
2974+ * Returns the requests a lazy barrel still defers, which neither render nor
2975+ * report what they would once requested, though no connection changes.
2976+ * @private
2977+ * @param {Module } module the module
2978+ * @returns {string | undefined } the deferred requests as one key, if any
2979+ */
2980+ _getLazyRequests ( module ) {
2981+ const lazyRequests = this . _lazyBarrels . getLazyRequests ( module ) ;
2982+ return lazyRequests && JSON . stringify ( [ ...lazyRequests ] ) ;
2983+ }
2984+
29722985 /**
29732986 * Compute affected modules.
29742987 * @private
@@ -3028,23 +3041,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
30283041 return true ;
30293042 } ;
30303043
3031- /**
3032- * Returns the requests a lazy barrel still defers, which render nothing
3033- * where a missing target renders a throw, though neither has a connection.
3034- * @param {Module } module the module
3035- * @returns {string | undefined } the deferred requests as one key, if any
3036- */
3037- const getLazyRequests = ( module ) => {
3038- const lazyRequests = this . _lazyBarrels . getLazyRequests ( module ) ;
3039- return lazyRequests && JSON . stringify ( [ ...lazyRequests ] ) ;
3040- } ;
3041-
30423044 const modulesWithoutCache = new Set ( modules ) ;
30433045 for ( const [ module , cachedMemCache ] of moduleMemCacheCache ) {
30443046 if ( modulesWithoutCache . has ( module ) ) {
30453047 const buildInfo = module . buildInfo ;
30463048 if ( buildInfo ) {
3047- const lazyRequests = getLazyRequests ( module ) ;
3049+ const lazyRequests = this . _getLazyRequests ( module ) ;
30483050 if ( cachedMemCache . buildInfo !== buildInfo ) {
30493051 // use a new one
30503052 /** @type {MemCache } */
@@ -3093,7 +3095,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
30933095 moduleMemCacheCache . set ( module , {
30943096 buildInfo,
30953097 references : computeReferences ( module ) ,
3096- lazyRequests : getLazyRequests ( module ) ,
3098+ lazyRequests : this . _getLazyRequests ( module ) ,
30973099 memCache
30983100 } ) ;
30993101 moduleMemCaches . set ( module , memCache ) ;
@@ -3632,15 +3634,20 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
36323634 continue ;
36333635 }
36343636 let token ;
3637+ /** @type {string | true } */
3638+ let clean = true ;
36353639 if ( useReportCacheTokens ) {
3640+ // a request leaving a lazy barrel reports without any rebuild
3641+ const lazyRequests = this . _getLazyRequests ( module ) ;
3642+ if ( lazyRequests !== undefined ) clean = lazyRequests ;
36363643 token = dependencyReportCacheTokens . get ( module ) ;
36373644 const cleanModules = modulesWithoutProblems . get (
36383645 /** @type {DependencyReportCacheToken } */ ( token )
36393646 ) ;
36403647 if (
36413648 ! unresolved &&
36423649 cleanModules !== undefined &&
3643- cleanModules . has ( module )
3650+ cleanModules . get ( module ) === clean
36443651 ) {
36453652 continue ;
36463653 }
@@ -3677,10 +3684,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
36773684 if ( cleanModules === undefined ) {
36783685 modulesWithoutProblems . set (
36793686 /** @type {DependencyReportCacheToken } */ ( token ) ,
3680- ( cleanModules = new WeakSet ( ) )
3687+ ( cleanModules = new WeakMap ( ) )
36813688 ) ;
36823689 }
3683- cleanModules . add ( module ) ;
3690+ cleanModules . set ( module , clean ) ;
36843691 }
36853692 }
36863693 }
0 commit comments