Skip to content

fix(vite): generate .mts config files to force ESM - #33518

Merged
jaysoo merged 6 commits into
masterfrom
NXC-3446
Nov 19, 2025
Merged

fix(vite): generate .mts config files to force ESM#33518
jaysoo merged 6 commits into
masterfrom
NXC-3446

Conversation

@jaysoo

@jaysoo jaysoo commented Nov 17, 2025

Copy link
Copy Markdown
Member

Using .mts extension forces files to always be treated as ESM modules, ensuring consistent behavior regardless of package.json or tsconfig settings.

This matters for Node 24 because by default Node will strip types from .ts files and then they are resolved through normal Node resolution. In the past we can control CJS/ESM through tsconfig options, but now only extension or type in package.json matters.

Changes:

  • Updated all createOrEditViteConfig calls to pass useEsmExtension: true
  • Updated normalizeViteConfigFilePathWithTree to check for .mts files first
  • Updated test files to expect .mts config files
  • Updated snapshots to reflect new .mts extension

Closes NXC-3446

Using .mts extension forces files to always be treated as ESM modules,
ensuring consistent behavior regardless of package.json or tsconfig settings.

This matters for Node 24 because by default Node will strip types from
`.ts` files and then they are resolved through normal Node resolution.
In the past we can control CJS/ESM through tsconfig options, but now
only extension or `type` in `package.json` matters.

Changes:
- Updated all createOrEditViteConfig calls to pass useEsmExtension: true
- Updated normalizeViteConfigFilePathWithTree to check for .mts files first
- Updated test files to expect .mts config files
- Updated snapshots to reflect new .mts extension

Closes NXC-3446
@vercel

vercel Bot commented Nov 17, 2025

Copy link
Copy Markdown

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

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Nov 19, 2025 3:48pm
@netlify

netlify Bot commented Nov 17, 2025

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 24e82e5
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/691ddff393db6d00082ccc80
😎 Deploy Preview https://deploy-preview-33518--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 24e82e5

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 2m 28s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 38s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 4s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 15m 13s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-19 15:44:13 UTC

@jaysoo
jaysoo marked this pull request as ready for review November 19, 2025 15:37
@jaysoo
jaysoo requested review from a team and Coly010 as code owners November 19, 2025 15:37
@jaysoo
jaysoo requested a review from AgentEnder November 19, 2025 15:37
@jaysoo
jaysoo merged commit 618c334 into master Nov 19, 2025
21 checks passed
@jaysoo
jaysoo deleted the NXC-3446 branch November 19, 2025 21:49
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants