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.
This PR implements the first round of lazy loading for the site. In general, the only significant impact is on the bundle size reduction for the home page and the guide list.
The guides themselves should also see a significant reduction in bundle size, but they depend upon the
DocViewer
which depends on theExampleViewer
which pulls in the full@angular/components-examples
along with every Angular Material and CDK component.This is the first step towards solving #176, which calls out the concerns with
ExampleViewer
.ExampleViewer
isn't tied to a route, so we can't lazy load it the normal way.Most Guide's only need the
DocViewer
, but the following 3 guides do actually require theExampleViewer
:Further investigation is needed to
ExampleViewer
ComponentViewer
to only import the components and examples needed for the current componentImpacts
Listed as compressed bundle size on page load with cache disabled in Chrome ("transferred").
Homepage
Before: 600 KB
After: 331 KB
✅ 45% reduction
Guide List
Before: 594 KB
After: 342 KB
✅ 42% reduction
Guide Viewer
Before: 618 KB
After: 640 KB
🚧 3% increase
Component Docs
Before: 627 KB
After: 652 KB
🚧 4% increase