mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 23:21:08 +02:00
fix(mana/web): bundle rrule into SSR build to fix /calendar 500
`rrule@2.8.1` ships dual CJS/ESM builds but its `package.json` has no
`exports` field, so the SvelteKit Node adapter resolves it to the CJS
bundle at runtime. The named import `import { RRule } from 'rrule'`
then throws `SyntaxError: Named export 'RRule' not found` whenever
`/calendar` SSRs, which crashed every render of the route in production.
Adding `'rrule'` to `ssr.noExternal` forces Vite to bundle rrule into
the server output, where its CJS↔ESM interop layer handles the named
import correctly. The source files using rrule (`time-blocks/recurrence.ts`
and `calendar/components/CustomRecurrenceBuilder.svelte`) need no change.
Surfaced via the rebuilt `health-check.sh` ingress walk after a
postgres restart cycle pushed mana-app-web into a 500 state.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f46d1328d8
commit
c27cb84f28
1 changed files with 7 additions and 1 deletions
|
|
@ -48,7 +48,13 @@ export default defineConfig({
|
|||
strictPort: true,
|
||||
},
|
||||
ssr: {
|
||||
noExternal: [...MANA_SHARED_PACKAGES, ...APP_SHARED_PACKAGES],
|
||||
// `rrule@2` ships dual CJS/ESM but its package.json has no `exports`
|
||||
// field, so the SvelteKit Node adapter resolves it to the CJS bundle
|
||||
// at runtime — and `import { RRule } from 'rrule'` then throws
|
||||
// `Named export 'RRule' not found` when /calendar SSRs. Bundling rrule
|
||||
// into the server build forces Vite's interop layer to handle the
|
||||
// CJS↔ESM mismatch correctly.
|
||||
noExternal: [...MANA_SHARED_PACKAGES, ...APP_SHARED_PACKAGES, 'rrule'],
|
||||
external: ['@mlc-ai/web-llm'],
|
||||
},
|
||||
optimizeDeps: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue