This repository has been archived by the owner on May 15, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ | |
}, | ||
"modules": false, | ||
"useBuiltIns": true | ||
}]] | ||
}]], | ||
"plugins": ["syntax-dynamic-import"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
a4ec643
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.
This commit splits the app by routes using the dynamic
import()
. Corresponding article sectionThe idea behind this is as follows. The
/users/
page is a single-page app: it’s built into JS, and it has a router. When a user visits a specific page (e.g./users/#/ai/following
), they don’t need other pages. So we wrap the pages’ code withimport()
and load it only when they are necessary.Generated files
Before:
After:
In our case, moving out the routes doesn’t have a large effect because they’re small. However, in a larger app, this might provide a great benefit! (I’ve seen cases where the initial rendering time was decreased by 60-70%.)