fix(preview): move formatDate/formatDateTime into runtime subtree#3749
fix(preview): move formatDate/formatDateTime into runtime subtree#3749daresTheDevil wants to merge 2 commits intonuxt:mainfrom
Conversation
The preview runtime imported these helpers from `src/utils/content/ transformers/utils`, which lives outside the `runtime/` subtree. nuxt-module-build bundles `src/utils/` into the main chunk but emits `src/runtime/` files as separate modules — so the cross-tree import resolves to a path that doesn't exist in the published package. This breaks Cloudflare Workers (strict module resolution) and any other runtime that doesn't tolerate dangling imports. Fix: duplicate the two small functions into `src/runtime/internal/ preview/utils.ts` and update the import in `collection.ts`. Closes nuxt#3742
Covers the duplicated date formatters in the preview runtime subtree. Includes a drift guard that asserts both copies (runtime and build-time) produce identical output, so they can't silently diverge.
|
@daresTheDevil is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
📝 WalkthroughWalkthroughThis change resolves a broken import path reported in issue Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
🔗 Linked issue
Resolves #3742
❓ Type of change
📚 Description
src/runtime/internal/preview/collection.tsimportedformatDate/formatDateTimefrom../../../utils/content/transformers/utils.nuxt-module-buildbundlessrc/utils/into the main chunk but emitssrc/runtime/files as separate modules — so that cross-tree import resolves to a path that doesn't exist in the published package.Cloudflare Workers (strict module resolution) throws on the dangling import, breaking all v3.12 deploys on CF.
Fix: duplicate the two small functions into
src/runtime/internal/preview/utils.tsand update the import incollection.ts. Added unit tests with a drift guard that asserts both copies produce identical output.📝 Checklist