Draft
Conversation
… splitting Convert all route components to use loadComponent for lazy loading instead of eager imports. Remove bulk NgModule imports from main.ts bootstrap since standalone components already import what they need. Initial bundle drops from 4.43 MB to 1.47 MB (67% reduction). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Converted all page-level routes from eagerly imported components to lazy-loaded routes using loadComponent with dynamic imports. This splits each page into its own chunk so the browser only downloads code for the current route, cutting the initial bundle size significantly. Also removed ~30 eagerly imported NgModule re-exports (PrimeNG, Angular Material, Forms, etc.) from main.ts that were bundled upfront as dead weight -- standalone components already import what they need individually.
In app-routing.module.ts, all component route definitions were replaced with loadComponent arrow functions and the AppRoutingModule NgModule class was removed in favor of exporting routes directly. In main.ts, switched to provideRouter(routes) for standalone bootstrapping and dropped the bulk importProvidersFrom call. Only BrowserModule and DynamicDialogModule remain as root providers.
Test Cases
.then((m) => m.ComponentName)Checklist
package-lock.jsonchanges (unless dependencies have changed)Closes #199