fix: esm module 99 and cjs module 100#354
Conversation
🦋 Changeset detectedLatest commit: 8405e08 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughA changeset and configuration update for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
|
View your CI Pipeline Execution ↗ for commit 8405e08
☁️ Nx Cloud last updated this comment at |
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/vite-config/src/index.ts (1)
60-60: Use named constants for TypeScript module kinds and correct the Node16 label.Lines 60 and 86 use raw numeric literals (
99,100) instead of named constants, and the comment on line 86 labels100as "CommonJS - Node16", which is misleading. Node16 models Node's dual ESM/CommonJS system where TypeScript decides per-file emission based on file extension andpackage.json—it is not equivalent to CommonJS. Use explicit named constants and label asNode16to improve maintainability and prevent confusion.♻️ Suggested refactor
+const DTS_MODULE_KIND_ESM = 99 // TypeScript ModuleKind.ESNext +const DTS_MODULE_KIND_NODE16 = 100 // TypeScript ModuleKind.Node16 + export const tanstackViteConfig = (options: Options): UserConfig => { @@ compilerOptions: { - module: 99, // ESNext + module: DTS_MODULE_KIND_ESM, declarationMap: false, }, @@ compilerOptions: { - module: 100, // CommonJS - Node16 + module: DTS_MODULE_KIND_NODE16, declarationMap: false, },Also applies to: 86-86
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/vite-config/src/index.ts` at line 60, Replace the raw numeric module kind literals with TypeScript's named enum members: change occurrences of "module: 99" to "module: ts.ModuleKind.ESNext" and "module: 100" to "module: ts.ModuleKind.Node16", and update the comment that currently says "CommonJS - Node16" to just "Node16"; ensure the file imports or references the TypeScript namespace (e.g., import * as ts from 'typescript') so ts.ModuleKind is available and use these enum names in the configuration object(s) where "module: 99" and "module: 100" appear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/vite-config/src/index.ts`:
- Line 60: Replace the raw numeric module kind literals with TypeScript's named
enum members: change occurrences of "module: 99" to "module:
ts.ModuleKind.ESNext" and "module: 100" to "module: ts.ModuleKind.Node16", and
update the comment that currently says "CommonJS - Node16" to just "Node16";
ensure the file imports or references the TypeScript namespace (e.g., import *
as ts from 'typescript') so ts.ModuleKind is available and use these enum names
in the configuration object(s) where "module: 99" and "module: 100" appear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4be906f1-b7b5-42fe-a3a4-363ee6480c35
📒 Files selected for processing (2)
.changeset/cool-needles-hear.mdpackages/vite-config/src/index.ts
Remake of:
@lachlancollins I think we have to stay on:
CJS - module 100
ESM - module 99
When i bump vite-config to 0.5.1 in tanstack/router, I get errors with import.meta otherwise.
There is a patch in this PR:
Summary by CodeRabbit