You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: externalize CJS-only npm packages in SSR build (#3653)
CJS dependencies like Sharp, ioredis, and MongoDB cause TDZ errors
when Rollup bundles the SSR output, because the CJS-to-ESM transform
hoists require() to import declarations that Rollup can reorder.
Instead of transforming CJS modules, externalize them in the SSR
build so they're loaded at runtime by Deno's Node compat layer.
A package is externalized only if it has no ESM entry point (no
"type": "module", no "module" field, no "import" condition in
"exports"). Framework packages (preact, fresh) are always bundled
to avoid duplicate module instances.
This should also fix#3673 (ioredis), #3505 (mongoose), #3478
(mongodb), and #3449 (supabase/postgres-js).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments