Repository navigation
fix(console): self-host monaco and brand icons instead of CDN - #23
Conversation
The YAML view on deploy/edit forms intermittently hung on a "Loading…"
placeholder forever. @monaco-editor/react, with no loader configured and
no bundled monaco, falls back to fetching the whole editor from jsDelivr
at runtime; on a slow, proxied, or air-gapped network the multi-megabyte
editor.main.js stalls and the fallback never clears. The sidebar brand
icons (simple-icons) were pulled from the same CDN, so neither subsystem
worked without reliable egress to cdn.jsdelivr.net.
Bundle both instead so nothing is fetched from a CDN at runtime:
- Add monaco-editor as a direct dep and configure @monaco-editor/react
via loader.config({ monaco }) with the language workers wired to the
bundled copies (monaco-setup.ts). loader.init() short-circuits on the
provided instance before it would ever inject the jsDelivr script.
- Lazy-load YamlEditor so monaco and its workers are code-split into
their own chunk, fetched from the app's own origin only when the YAML
view is opened — the initial bundle is unaffected.
- Inline simple-icons SVGs as data URIs from the bundled package. Amazon
S3 was removed upstream from simple-icons, so the Bucket kind now falls
back to a generic Lucide storage glyph.
A production build shows simple-icons fully inlined and the only
remaining jsDelivr string is the unreachable default paths.vs inside the
third-party loader, which loader.init() never reaches once monaco is
provided.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
|
Warning Review limit reached
More reviews will be available in 14 minutes. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request self-hosts the Monaco Editor and bundles its language workers to prevent external CDN fetches, improving reliability in air-gapped environments. It also lazy-loads the YamlEditor component to optimize initial bundle size and page load performance. Additionally, sidebar icons are refactored to import brand logos directly from the simple-icons package and inline them as data URIs, eliminating external CDN dependencies, and a fallback is added for the Bucket kind. I have no feedback to provide as there are no review comments.
Problem
The YAML view on deploy/edit forms intermittently hung on a
Loading…placeholder and never rendered.@monaco-editor/react, with no loader configured and no bundled monaco, falls back to fetching the entire editor from jsDelivr at runtime; on a slow, proxied, or air-gapped network the multi-megabyteeditor.main.jsstalls inpendingand the fallback never clears. The sidebar brand icons (simple-icons) were pulled from the same CDN, so neither subsystem worked without reliable egress tocdn.jsdelivr.net.Fix
Bundle both so nothing is fetched from a CDN at runtime:
loader.config({ monaco })with the language workers pointed at the bundled copies. The loader resolves on the provided instance and never injects the jsDelivr script.YamlEditoris now lazy-loaded, so monaco and its workers land in their own chunk fetched from the app's own origin only when the YAML view opens. The initial bundle is unaffected.data:URIs from the bundled package (tree-shaken to the ~17 icons actually used). Amazon S3 was removed upstream from simple-icons, so theBucketkind now falls back to a generic Lucide storage glyph.Verification
cdn.jsdelivr.netstring in the build is the unreachable defaultpaths.vsinside the third-party loader —init()returns on the bundled monaco before it could ever be used. Confirmed against the loader source.monaco-setupis configured with the bundled instance and routes workers; the rendered brand icon uses adata:URI and never a CDN host.pnpm typecheckandpnpm test(217 passing) are green.