Skip to content

fix: alias dayjs imports to ESM builds for Vite SSR compatibility#743

Open
rsbh wants to merge 1 commit intomainfrom
fix_dayjs_esm_import
Open

fix: alias dayjs imports to ESM builds for Vite SSR compatibility#743
rsbh wants to merge 1 commit intomainfrom
fix_dayjs_esm_import

Conversation

@rsbh
Copy link
Copy Markdown
Member

@rsbh rsbh commented Apr 16, 2026

Summary

  • Vite SSR module runner can't convert dayjs's CJS module.exports to ESM default export, causing dayjs to be undefined and .extend() to crash
  • Use rollup output.paths to rewrite dayjsdayjs/esm and dayjs/plugin/*dayjs/esm/plugin/* in ESM output only
  • CJS output unchanged — no breakage for CJS consumers

Test plan

  • Verify ESM dist imports reference dayjs/esm/...
  • Verify CJS dist imports reference dayjs (unchanged)
  • Test in Vite SSR app — dayjs no longer undefined

🤖 Generated with Claude Code

dayjs CJS default export breaks in Vite SSR module runner. Use rollup
output.paths to rewrite dayjs imports to dayjs/esm in ESM output only,
keeping CJS output unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Apr 16, 2026 9:10am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df4702ee-2928-442c-a848-307cedaf08db

📥 Commits

Reviewing files that changed from the base of the PR and between 26e02f6 and 5b0912e.

📒 Files selected for processing (3)
  • packages/raystack/components/calendar/date-picker.tsx
  • packages/raystack/components/data-table/utils/filter-operations.tsx
  • packages/raystack/rollup.config.mjs

📝 Walkthrough

Walkthrough

The pull request updates Day.js plugin import statements across multiple files by removing explicit .js file extensions from module paths. Additionally, it configures Rollup's output.paths mapping in the ES module build to rewrite dayjs imports to their ES module equivalents, redirecting dayjs to dayjs/esm and dayjs/plugin/* to dayjs/esm/plugin/*. These changes standardize module resolution for Day.js dependencies without altering component logic or runtime behavior.

Suggested reviewers

  • rohilsurana
  • paanSinghCoder
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding ESM-specific day.js import paths to resolve Vite SSR compatibility issues.
Description check ✅ Passed The description clearly explains the problem (Vite SSR cannot convert CJS module.exports), the solution (Rollup output.paths rewrite), and impact (only ESM affected, CJS unchanged).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants