Skip to content

chore(client): Migrate client config to esm - #545

Open
serendipty01 wants to merge 7 commits into
roostorg:mainfrom
serendipty01:migrate-client-config-esm
Open

chore(client): Migrate client config to esm#545
serendipty01 wants to merge 7 commits into
roostorg:mainfrom
serendipty01:migrate-client-config-esm

Conversation

@serendipty01

@serendipty01 serendipty01 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Context & Requests for Reviewers

fixes #546

Migrates the client's build configuration from CommonJS to native ES Modules:

  • tailwind.config.jstailwind.config.mjs and postcss.config.jspostcss.config.mjsmodule.exports becomes export default, and require('tailwindcss-animate') becomes a real ESM import.
  • client/package.json gains "type": "module", so every .js file in the package has one unambiguous module format. The in-repo ESLint rules folder gets its own package.json with "type": "commonjs" as a shield for the still-CJS eslint/index.js.
  • Removes the vite-plugin-commonjs dependency — Vite's built-in optimizeDeps handles CJS interop natively, so the plugin was redundant (one less dependency to audit and keep compatible with Vite upgrades).
  • Adds a /// <reference types="vitest/config" /> directive to vite.config.ts, fixing a previously-masked TypeScript error on the test config block.

Why: ESM configs are the direction the ecosystem has settled on (Vite, Tailwind 4, and most tooling are ESM-first), the server package is already "type": "module", and with the flag set a stray require() now fails loudly (ERR_REQUIRE_ESM) instead of behaving differently per tool. This also clears the path for future Vite/Tailwind major upgrades that assume ESM configs.

Tests

Automated (all at branch head):

  • npm run build ✓, npm run lint 0 errors, test suite shows only failures that also fail on pristine main
  • rg "require\(" client/src --glob '*.js' → only src/rechartsScaleWrapper.js, which is dead code on main too (its alias never fires; verified absent from the build output) — no regression from removing vite-plugin-commonjs
  • No tooling references the old *.config.js names

Manual, on a fresh environment (volumes dropped, all migrations re-applied, dev servers):

  • Vite dev server boots with no CJS interop warnings; app loads with Tailwind styling intact
  • Animations verified working in the live app (tooltips/dialogs), plus a DevTools probe: an element with animate-in fade-in computes animation-name: enter, 0.15s — direct proof the tailwindcss-animate ESM default import resolved to a real plugin (the riskiest line in this PR; had it resolved to undefined, Tailwind would silently drop all animation utilities)

🤖 AI Usage Disclosure

Generated with Claude Code

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Migrated development and styling configuration files to ES module format.
    • Removed legacy CommonJS compatibility tooling from the client build setup.
    • Updated ESLint ignore patterns to target the correct Tailwind/PostCSS config files.

Copilot AI review requested due to automatic review settings May 21, 2026 16:47
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@serendipty01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c01e787-6017-415f-9f7d-809098f26619

📥 Commits

Reviewing files that changed from the base of the PR and between 361ef99 and ba09ed9.

⛔ Files ignored due to path filters (1)
  • client/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • client/.dockerignore
  • client/.eslintrc.cjs
  • client/eslint.config.mjs
  • client/eslint/package.json
  • client/package.json
  • client/postcss.config.mjs
  • client/tailwind.config.mjs
  • client/vite.config.ts
📝 Walkthrough

Walkthrough

Client config is migrated to ESM: the package declares "type": "module", vite-plugin-commonjs is removed, ESLint ignores updated config filenames, and PostCSS/Tailwind configs now use ES module exports.

Changes

ES Module System Migration

Layer / File(s) Summary
Package module type and dependency cleanup
client/package.json
Package.json declares type: module and removes the vite-plugin-commonjs dev dependency.
Vite plugin configuration simplification
client/vite.config.ts
Remove the vite-plugin-commonjs import and its commonjs() plugin entry from the Vite plugins array.
ESLint configuration updates for .mjs
client/.eslintrc.cjs, client/eslint.config.mjs, client/eslint/package.json
ESLint ignore patterns updated to reference tailwind.config.mjs and postcss.config.mjs; client/eslint/package.json sets "type": "commonjs".
Config files migration to ES modules
client/postcss.config.mjs, client/tailwind.config.mjs
PostCSS and Tailwind configs switch from CommonJS module.exports to ESM export default; Tailwind plugin wiring uses the imported animate binding.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: cassidyjames, julietshen, vinaysrao1, dom-notion

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR converts client configs to ESM and removes vite-plugin-commonjs, matching the linked issue objectives.
Out of Scope Changes check ✅ Passed The changed ESLint/package metadata appears supporting the ESM migration and not unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating client config to ESM.
Description check ✅ Passed The description covers context and testing clearly; the optional rollout plan and checklist are omitted but the core template is present.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@serendipty01 serendipty01 changed the title Migrate client config esm Migrate client config to esm May 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR migrates the client’s build/styling configuration to ESM and removes the CommonJS compatibility plugin from Vite.

Changes:

  • Switch tailwind.config.js and postcss.config.js from CommonJS (module.exports/require) to ESM (import/export default).
  • Mark the client package as ESM via "type": "module" and update Tailwind animate plugin usage to ESM import.
  • Remove vite-plugin-commonjs from both vite.config.ts and package.json.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
client/vite.config.ts Drops vite-plugin-commonjs from Vite plugins (and adds Vitest type reference).
client/tailwind.config.js Converts Tailwind config to ESM and switches tailwindcss-animate to an ESM import.
client/postcss.config.js Converts PostCSS config to ESM export.
client/package.json Sets ESM mode for the package and removes vite-plugin-commonjs dependency.
Files not reviewed (1)
  • client/package-lock.json: Language not supported

Comment thread client/package.json
Comment thread client/postcss.config.mjs
@serendipty01
serendipty01 force-pushed the migrate-client-config-esm branch from 6d2c5b1 to 0f50f95 Compare May 21, 2026 17:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/vite.config.ts`:
- Line 1: The file currently references Vitest types incorrectly; update the
triple-slash reference so the Vitest v4 config typings apply (so the test config
field is properly typed). Replace the top reference that points to "vitest" with
the v4 config reference used by Vitest ("vitest/config") and ensure defineConfig
(imported from Vite) and the test property use those updated types; verify the
test config autocompletes correctly for functions like defineConfig and the test
object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a11b25b0-0007-4973-9ba8-05becea2980c

📥 Commits

Reviewing files that changed from the base of the PR and between 6d2c5b1 and 0f50f95.

⛔ Files ignored due to path filters (1)
  • client/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • client/.eslintrc.cjs
  • client/eslint.config.mjs
  • client/eslint/package.json
  • client/package.json
  • client/postcss.config.mjs
  • client/tailwind.config.mjs
  • client/vite.config.ts
💤 Files with no reviewable changes (3)
  • client/postcss.config.mjs
  • client/package.json
  • client/tailwind.config.mjs
✅ Files skipped from review due to trivial changes (1)
  • client/.eslintrc.cjs

Comment thread client/vite.config.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • client/package-lock.json: Language not supported

@serendipty01 serendipty01 changed the title Migrate client config to esm chore(client): Migrate client config to esm Jul 7, 2026
@serendipty01
serendipty01 force-pushed the migrate-client-config-esm branch from 2a0f7e5 to 361ef99 Compare July 7, 2026 14:00
@serendipty01
serendipty01 requested a review from Copilot July 7, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • client/package-lock.json: Generated file
Comments suppressed due to low confidence (1)

client/postcss.config.mjs:1

  • client/.dockerignore currently whitelists postcss.config.js and tailwind.config.js (but not the new .mjs filenames). Because the dockerignore starts with *, Docker builds that use this context will exclude these config files, which can break Tailwind/PostCSS during container builds. Update client/.dockerignore to whitelist postcss.config.mjs and tailwind.config.mjs (and drop the old .js entries if the files are truly removed).

Copilot AI review requested due to automatic review settings July 21, 2026 17:33
@serendipty01
serendipty01 force-pushed the migrate-client-config-esm branch from 12da623 to 7ff57d3 Compare July 21, 2026 17:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • client/package-lock.json: Generated file

Comment thread client/vite.config.ts
Vite bundles the config through esbuild and shims __dirname/__filename
for it, so this worked fine as-is (verified: npm run build succeeds
both before and after). Making it explicit anyway per Copilot review,
using the same fileURLToPath(import.meta.url) pattern already used in
server/lib/cache/stores/RedisStore/RedisStore.ts, so the config
doesn't rely on Vite's config-loader shim.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 17:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • client/package-lock.json: Generated file

Comment thread client/vite.config.ts
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.

Migrate client config to pure ESM

2 participants