Repository navigation
perf(site): stop loading monaco on every page #31367
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
Changes from all commits
a5e693b
caa08fd
99783c6
7d80932
eff8991
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,12 +73,10 @@ export default defineConfig({ | |
| : "assets/[name]-[hash].js"; | ||
| }, | ||
| codeSplitting: { | ||
| groups: [ | ||
| { name: "monaco", test: /monaco-editor/ }, | ||
| { name: "xterm", test: /@xterm/ }, | ||
| { name: "emoji-picker", test: /frimousse|emojibase-data/ }, | ||
| { name: "radix-ui", test: /radix-ui/ }, | ||
| ], | ||
| // A group also takes the modules its matches import that no earlier group | ||
| // took: a monaco group takes Vite's preload helper, and an emoji-picker group | ||
| // ahead of radix-ui takes React, so either would load on every page. | ||
| groups: [{ name: "radix-ui", test: /radix-ui/ }], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3 [CRF-4] After a user opens a template files, version or editor page, the tab keeps monaco's stylesheet until reload, so the WebKit focus cost may come back for the rest of that tab's life. (Killua) The head's
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cost does return: on an earlier 60k-node page, deleting monaco's 4 rules after the 3 attachment rules cut WebKit idle focus from 145 to 12 ms. On
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accepted: this PR reduces which tabs pay the cost and adds none. The remaining cost comes from monaco's stylesheet, which this diff does not change, so it is in the review body as out of scope for a human to file or accept.
|
||
| }, | ||
| }, | ||
| }, | ||
|
|
||
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.
P4 [CRF-10] Neither this comment nor the PR description says why the lazy groups were deleted instead of kept with
includeDependenciesRecursively: false, which8204a25ee0tried first. (Leorio)The reason is only in the body of
169c9cc545, which the squash merge drops. Rolldown 1.2.14 recommends settingstrictExecutionOrder: truewith that option "to avoid generating invalid chunks" (rolldown/dist/shared/define-config-BLptERXo.d.mts:1228-1233). A developer who wants a stablemonaco-*.jsname back will reach for that option first. Append one line, for example:// includeDependenciesRecursively: false avoids this, but Rolldown requires strictExecutionOrder with it to avoid invalid chunks.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.
Not added:
includeDependenciesRecursively: falsealso keeps monaco out of the up-front chunks (a build of 8204a25's config loads 2,794,844 bytes up front against this PR's 2,794,832, with no import cycles), so a developer who reaches for it does not bring the regression back. Rolldown's doc comment on that option states thestrictExecutionOrderpairing where they would set it.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.
Accepted: with your measurement,
includeDependenciesRecursively: falsekeeps monaco lazy, and Rolldown's doc comment on that option states thestrictExecutionOrderrequirement where a developer sets it.