Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions site/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

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, which 8204a25ee0 tried first. (Leorio)

The reason is only in the body of 169c9cc545, which the squash merge drops. Rolldown 1.2.14 recommends setting strictExecutionOrder: true with that option "to avoid generating invalid chunks" (rolldown/dist/shared/define-config-BLptERXo.d.mts:1228-1233). A developer who wants a stable monaco-*.js name 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.

🤖

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not added: includeDependenciesRecursively: false also 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 the strictExecutionOrder pairing where they would set it.

🤖 Posted using /amend-review skill via Coder Agents.

Copy link
Copy Markdown
Contributor

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: false keeps monaco lazy, and Rolldown's doc comment on that option states the strictExecutionOrder requirement where a developer sets it.

🤖

// 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/ }],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 editor-Br_kD0ds.css has the same content hash as the base's monaco-Br_kD0ds.css (145,989 bytes, 4 :focus-within descendant rules), and the description states Vite does not remove it. The bench compared the whole monaco chunk, so how much of the 330 ms WebKit difference comes from these 4 rules is unverified. Run the #31278 WebKit bench after loading a template files page in the same tab; if the cost returns, either scope or remove those rules in this PR, or a human needs to file a ticket or accept the gap.

🤖

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 main every tab pays it from the first page; this PR leaves it only in tabs that opened a monaco page, as the description states, and scoping monaco's rules is a separate change.

🤖 Posted using /amend-review skill via Coder Agents.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

🤖

},
},
},
Expand Down
Loading