Migrated public UMD apps to rolldown-vite#29141
Draft
9larsons wants to merge 1 commit into
Draft
Conversation
ref PLA-96
- Pointed the 5 public/CDN apps (portal, comments-ui, signup-form,
sodo-search, announcement-bar) at a new `rolldown` catalog entry
(`vite: npm:rolldown-vite@7.3.1`); admin apps stay on stock vite@7.3.2.
- Dropped `output.manualChunks: false` from portal's config (Rolldown
rejects the `false` literal; lib mode + cssCodeSplit:false already emit
a single chunk).
- Replaced the `@rollup/plugin-commonjs` `dynamicRequireTargets` glob in
the shared factory with an `i18nLocaleBundlePlugin`. Rolldown does not
implement dynamicRequireTargets, so ghost/i18n's dynamic
`require(../locales/${locale}/${ns}.json)` no longer statically bundled
the locales — portal shrank from 2.4MB to 907KB and shipped English
only. The plugin statically imports every locales/*/<ns>.json and
rewrites the dynamic require to read from that registry, restoring full
translation coverage (all 62 locale files bundle again).
UMD output verified against the prior Rollup build: same self-executing
UMD wrapper, sizes within ~3%, all locales bundle, and sodo-search still
emits the load-bearing umd/main.css.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref PLA-96
Summary
Workstream F1 of the Rolldown migration: puts Ghost's public UMD apps (portal, comments-ui, signup-form, sodo-search, announcement-bar) on
rolldown-vite@7.3.1. These ship to site visitors via CDN, so this is a draft pending review + the runtime gate before merge.Admin apps are untouched — they stay on stock
vite@7.3.2. The migration is scoped via a new named catalog.Changes
pnpm-workspace.yaml: newrolldowncatalog →vite: npm:rolldown-vite@7.3.1. The 5 public apps'vitedep now points atcatalog:rolldown; every other workspace keepscatalog:(stockvite@7.3.2).apps/portal/vite.config.mjs: removedbuild.rollupOptions.output.manualChunks: false. Rolldown rejects thefalseliteral (manualChunks is not a function); lib mode +cssCodeSplit:falsealready yield a single chunk.apps/_shared/vite-public-app.mjs: replaced the@rollup/plugin-commonjsdynamicRequireTargetsglob with a newi18nLocaleBundlePlugin.The i18n regression this fixes
ghost/i18n'sgenerateResources()loads translations with a dynamicrequire(\../locales/${locale}/${ns}.json`). Under Rollup this was resolved at build time by@rollup/plugin-commonjs'sdynamicRequireTargets`, which eagerly bundled every locale file.Rolldown does not implement
dynamicRequireTargets. Left as-is, the dynamic require fell through and portal shrank from 2.4 MB → 907 KB, shipping English only — every non-English site would silently lose its translations.The new plugin re-expresses the same intent bundler-agnostically: it enumerates every
locales/<locale>/<ns>.jsonfor the app's namespace, statically imports them, and rewrites the dynamic require to read from that registry. All 62 locale files bundle again.Output verification (Rolldown vs. prior Rollup build)
umd/main.cssstill emitted (load-bearing)define.amd ? define([],e) : e()form in every app (empty AMD deps array vs. Rollup's no-argdefine(e)— semantically equivalent).umd/main.cssby name — theme templates reference it viasodoSearch.styles.Size deltas are within noise (rolldown-vite's oxc minifier vs. esbuild/terser). No output-correctness risks found.
Not in scope / follow-ups
rollupOptions: {output: {}}blocks in comments-ui/signup-form left as-is (no-ops under Rolldown, which aliasesrollupOptions).