Skip to content

Conversation

@Vansh5632
Copy link
Contributor

fixes: #19134

Fixed issue with external dependencies not loading properly on first visit when lazy compilation is enabled

Added logic to ensure external dependencies are properly initialized before lazy-loaded chunks that depend on them

Enhanced the LazyCompilationProxyModule to detect and handle external dependencies

Added new runtime helper to ensure external dependencies are loaded in the correct order

if (!hooks) {
hooks = {
createScript: new SyncWaterfallHook(["source", "chunk"])
createScript: new SyncWaterfallHook(["code", "chunk"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid unnecessary changes which is not related to fixes

}
return false;
})
: false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad idea, we should register runtime inside ExternalModule

makeSerializable(
ExternalModuleInitFragment,
"webpack/lib/dependencies/ExternalModuleInitFragment"
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it was removed?

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 30, 2025

CodSpeed Performance Report

Merging #19477 will not alter performance

Comparing Vansh5632:lazy-compilation (520c529) with main (56dd6ca)

Summary

✅ 4 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After turning on lazyCompilation, the first load of externals will fail

2 participants