Skip to content

Commit 6a253d0

Browse files
committed
fix(create): use bundler module resolution in monorepo template
The monorepo template's tsconfig used nodenext module resolution which requires explicit .js extensions on relative imports and breaks Vite config type autocomplete. Switch to module: preserve and moduleResolution: bundler which is correct for Vite projects. Closes #1029
1 parent cc37ea4 commit 6a253d0

8 files changed

Lines changed: 32 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "check-monorepo-template-typecheck",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function fn(): string {
2+
return 'hello';
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { fn } from '../src';
2+
3+
console.log(fn());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> vp exec tsc --noEmit
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"commands": ["vp exec tsc --noEmit"]
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"noEmit": true,
4+
"module": "preserve",
5+
"moduleResolution": "bundler",
6+
"allowImportingTsExtensions": true,
7+
"esModuleInterop": true,
8+
"skipLibCheck": true
9+
},
10+
"include": ["packages/**/*.ts"]
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { defineConfig } from 'vite';
2+
3+
export default defineConfig({});

packages/cli/templates/monorepo/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
33
"noEmit": true,
4-
"module": "nodenext",
5-
"moduleResolution": "nodenext",
4+
"module": "preserve",
5+
"moduleResolution": "bundler",
66
"allowImportingTsExtensions": true,
77
"esModuleInterop": true
88
}

0 commit comments

Comments
 (0)