Skip to content

Commit 4f6f9ca

Browse files
committed
tsconfig: Introduce new tsconfig.app.json
The change in 2aa6462 is resulting in a vite.config.js and vite.config.d.ts being generated which we don't want. The work around, to be able to have type checking of both src files and vite.config.ts during build is to create a dedicated tsconfig.app.json and tsconfig.node.json. See: * vitejs/vite#15913 * https://github.com/vuejs/create-vue/blob/f75fd9813a624b8e44b012608335721901aba00b/template/tsconfig/base/tsconfig.json
1 parent b1657bc commit 4f6f9ca

6 files changed

+40
-27
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Except...:
55
!resources/
66
!package.json
7+
!tsconfig.app.json
78
!tsconfig.json
89
!tsconfig.node.json
910
!vite.config.ts

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
],
1212
parser: "@typescript-eslint/parser",
1313
parserOptions: {
14-
project: ["./tsconfig.json", "./tsconfig.node.json"],
14+
project: ["./tsconfig.json", "./tsconfig.app.json", "./tsconfig.node.json"],
1515
tsconfigRootDir: __dirname,
1616
},
1717
plugins: ["import"],

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
!resources/
66
!.eslintrc.cjs
77
!package.json
8+
!tsconfig.app.json
89
!tsconfig.json
910
!tsconfig.node.json
1011
!vite.config.ts

tsconfig.app.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
16+
/* Absolute imports */
17+
"paths": {
18+
"@/*": ["./resources/js/*"]
19+
},
20+
21+
/* Linting */
22+
"strict": true,
23+
"noUnusedLocals": true,
24+
"noUnusedParameters": true,
25+
"noFallthroughCasesInSwitch": true
26+
},
27+
"include": ["resources/js"]
28+
}

tsconfig.json

+8-26
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"useDefineForClassFields": true,
5-
"module": "ESNext",
6-
"lib": ["ESNext", "DOM", "DOM.Iterable"],
7-
"skipLibCheck": true,
8-
9-
/* Bundler mode */
10-
"moduleResolution": "bundler",
11-
"allowImportingTsExtensions": true,
12-
"resolveJsonModule": true,
13-
"isolatedModules": true,
14-
"noEmit": true,
15-
16-
/* Absolute imports */
17-
"paths": {
18-
"@/*": ["./resources/js/*"]
2+
"files": [],
3+
"references": [
4+
{
5+
"path": "./tsconfig.app.json"
196
},
20-
21-
/* Linting */
22-
"strict": true,
23-
"noUnusedLocals": true,
24-
"noUnusedParameters": true,
25-
"noFallthroughCasesInSwitch": true
26-
},
27-
"include": ["resources/js"],
28-
"references": [{ "path": "./tsconfig.node.json" }]
7+
{
8+
"path": "./tsconfig.node.json"
9+
},
10+
]
2911
}

tsconfig.node.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"skipLibCheck": true,
55
"module": "ESNext",
66
"moduleResolution": "bundler",
7+
"noEmit": true,
78
"allowSyntheticDefaultImports": true,
89
"strict": true
910
},

0 commit comments

Comments
 (0)