-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat(@angular/ssr): add modulepreload for lazy-loaded routes
#28919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
95f2b19 to
9b4c01a
Compare
913f62e to
1eb3c20
Compare
This only happens during the build, when building the manifest, on a production server the preloads are already extracted. |
2db94b8 to
84c0543
Compare
212ad1a to
d78d2ad
Compare
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Outdated
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Outdated
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/compilation/aot-compilation.ts
Outdated
Show resolved
Hide resolved
509feb7 to
b15ae1f
Compare
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
tests/legacy-cli/e2e/tests/build/server-rendering/server-routes-preload-links.ts
Show resolved
Hide resolved
b15ae1f to
4281f58
Compare
dgp1130
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just responding to some comment threads, I'll take another look at the code on Monday.
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
tests/legacy-cli/e2e/tests/build/server-rendering/server-routes-preload-links.ts
Show resolved
Hide resolved
4281f58 to
572c1a0
Compare
dgp1130
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No major concerns on my end. I'm on board with an initial implementation like this and we can work through any edge cases or deoptimizations as they come.
I kind of suspect we'll want to expand the transform to apply to any dynamic import inside a loadComponent / loadChildren function, but I'm happy to keep this constrained for now and expand it later.
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Outdated
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer_spec.ts
Show resolved
Hide resolved
packages/angular/build/src/tools/angular/transformers/lazy-routes-transformer.ts
Show resolved
Hide resolved
AndrewKushnir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @alan-agius4 👍
Enhance performance when using SSR by adding `modulepreload` links to lazy-loaded routes. This ensures that the required modules are preloaded in the background, improving the user experience and reducing the time to interactive. Closes angular#26484
572c1a0 to
31ff83a
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Enhance performance when using SSR by adding
modulepreloadlinks to lazy-loaded routes. This ensures that the required modules are preloaded in the background, improving the user experience and reducing the time to interactive.Closes #26484