Title: fix: stop shipping duplicate JS chunks on published pages · Issue #548 · ycode/ycode · GitHub
Open Graph Title: fix: stop shipping duplicate JS chunks on published pages · Issue #548 · ycode/ycode
X Title: fix: stop shipping duplicate JS chunks on published pages · Issue #548 · ycode/ycode
Description: Summary Published sites currently download two ~499 KB (≈148 KiB gzip) JavaScript chunks with substantially overlapping modules. On the client website those files are: /_next/static/chunks/d6c471d59bccc477.js — 487 KiB raw / ≈141 KiB gzi...
Open Graph Description: Summary Published sites currently download two ~499 KB (≈148 KiB gzip) JavaScript chunks with substantially overlapping modules. On the client website those files are: /_next/static/chunks/d6c471d5...
X Description: Summary Published sites currently download two ~499 KB (≈148 KiB gzip) JavaScript chunks with substantially overlapping modules. On the client website those files are: /_next/static/chunks/d6c471d5...
Opengraph URL: https://github.com/ycode/ycode/issues/548
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix: stop shipping duplicate JS chunks on published pages","articleBody":"## Summary\n\nPublished sites currently download **two ~499 KB (≈148 KiB gzip) JavaScript chunks** with substantially overlapping modules. On the client website those files are:\n\n- `/_next/static/chunks/d6c471d59bccc477.js` — 487 KiB raw / ≈141 KiB gzip\n- `/_next/static/chunks/85c333a8896677df.js` — 487 KiB raw / ≈141 KiB gzip\n\nThey are not byte-identical (Turbopack minifies each graph separately), but both contain the same Tiptap/ProseMirror stack, rich-text rendering, `layer-utils`, and a `POST /ycode/api/components` helper. Lighthouse flags this as duplicated JavaScript and it is a large share of the 650–730 ms mobile TBT reported by the customer.\n\nCustomer report (14 Sep 2026): mobile Lighthouse 45 / 64, LCP 11.4 s / 3.9 s.\n\n## Why this happens\n\nTwo client entry points both statically import `LayerRendererPublic`:\n\n1. `PageRenderer` (the published page)\n2. `app/(site)/error.tsx` (re-exported by `app/(published)/[[...slug]]/error.tsx`)\n\nNext.js always ships the route error boundary with the page. Because `LayerRendererPublic` pulls a large shared graph (`layer-utils` → `text-format-utils` → `@tiptap/core` via a **circular import** with `lib/tiptap-extensions/rich-text-link.ts`), Turbopack cannot extract a common chunk and emits the graph twice.\n\nRelated: #501 (editor APIs / Tiptap on the public bundle).\n\n## Proposed fix\n\n- Stop importing `LayerRendererPublic` from `error.tsx`. Render a lightweight 500 fallback (or dynamically import the renderer only after the error page data is fetched).\n- Break the `text-format-utils` ↔ `rich-text-link` cycle so a single shared chunk can be extracted if both entries still need render helpers.\n- Confirm with a production (or customer-site) Lighthouse treemap that only one copy of ProseMirror/`layer-utils` ships.\n\n## Test plan\n\n- [ ] Homepage HTML includes only one ~500 KB public-renderer chunk (or a small shared vendor chunk + one entry), not two overlapping copies\n- [ ] Custom 500 page still renders after a thrown error\n- [ ] Mobile Lighthouse unused/duplicated JS for those hashes drops by ~140 KiB transferred\n- [ ] Preview error boundary (`app/(site)/ycode/preview/error.tsx`) is treated the same way\n","author":{"url":"https://github.com/ysamcode","@type":"Person","name":"ysamcode"},"datePublished":"2026-09-15T05:43:35Z","url":"https://github.com/ycode/ycode/issues/548"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:84370c1a-33e7-5cb6-c677-3ead69c7a530 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6D0:2BFC5C:CE194:10E7DA:6AFE330A |
| html-safe-nonce | 23f012016db2891343d6698881a42a58d64fbefe978a8fbb74b236dbe8e8e526 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkQwOjJCRkM1QzpDRTE5NDoxMEU3REE6NkFGRTMzMEEiLCJ2aXNpdG9yX2lkIjoiNDcyNzI1MzU4Mjg4Mzk5MjMzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 451973dc0c087762dc37a63837db0aab4fea81eaaaec644a33ce4bf27629c22a |
| hovercard-subject-tag | issue:5458036387 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ycode/ycode/548/issue_layout |
| twitter:image | https://opengraph.githubassets.com/266c7514355ceef865099303968bb4941ff2e8eaa66f605d098069166fe99ee6/ycode/ycode/issues/548 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/266c7514355ceef865099303968bb4941ff2e8eaa66f605d098069166fe99ee6/ycode/ycode/issues/548 |
| og:image:alt | Summary Published sites currently download two ~499 KB (≈148 KiB gzip) JavaScript chunks with substantially overlapping modules. On the client website those files are: /_next/static/chunks/d6c471d5... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ysamcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | d70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/ycode/ycode git https://github.com/ycode/ycode.git |
| octolytics-dimension-user_id | 65892203 |
| octolytics-dimension-user_login | ycode |
| octolytics-dimension-repository_id | 1165452593 |
| octolytics-dimension-repository_nwo | ycode/ycode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1165452593 |
| octolytics-dimension-repository_network_root_nwo | ycode/ycode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ccb88d9c92abe69245b429398c8a57ae87070c7c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width