File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed
packages/vite-plugin-checker/src Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -141,10 +141,11 @@ export default {
141
141
142
142
### config.typescript
143
143
144
- | field | Type | Default value | Description |
145
- | :----------- | -------- | ----------------------------------------------------- | -------------------------------- |
146
- | root | ` string ` | [ Vite config] ( https://vitejs.dev/config/#root ) ` root ` | Root path to find tsconfig file |
147
- | tsconfigPath | ` string ` | ` "tsconfig.json" ` | Relative tsconfig path to ` root ` |
144
+ | field | Type | Default value | Description |
145
+ | :----------- | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
+ | root | ` string ` | [ Vite config] ( https://vitejs.dev/config/#root ) ` root ` | Root path to find tsconfig file |
147
+ | tsconfigPath | ` string ` | ` "tsconfig.json" ` | Relative tsconfig path to ` root ` |
148
+ | buildMode | ` boolean ` | ` false ` | Add [ ` --build ` ] ( https://www.typescriptlang.org/docs/handbook/project-references.html ) to ` tsc ` flag, note that ` noEmit ` does NOT work if ` buildMode ` is ` true ` ([ #36917 ] ( https://github.com/microsoft/TypeScript/issues/36917 ) ) |
148
149
149
150
### config.vls
150
151
Original file line number Diff line number Diff line change @@ -123,12 +123,21 @@ export class TscChecker extends Checker<'typescript'> {
123
123
absFilePath : __filename ,
124
124
build : {
125
125
buildBin : ( config ) => {
126
- if ( typeof config . typescript === 'object' && config . typescript . tsconfigPath ) {
127
- const tsconfig = config . typescript . root
128
- ? path . join ( config . typescript . root , config . typescript . tsconfigPath )
129
- : config . typescript . tsconfigPath
130
- return [ 'tsc' , [ '--noEmit' , '-p' , tsconfig ] ]
126
+ if ( typeof config . typescript === 'object' ) {
127
+ const { root, tsconfigPath, buildMode } = config . typescript
128
+
129
+ // Compiler option '--noEmit' may not be used with '--build'
130
+ let args = [ buildMode ? '-b' : '--noEmit' ]
131
+
132
+ // Custom config path
133
+ if ( tsconfigPath ) {
134
+ const fullConfigPath = root ? path . join ( root , tsconfigPath ) : tsconfigPath
135
+ args = args . concat ( [ '-p' , fullConfigPath ] )
136
+ }
137
+
138
+ return [ 'tsc' , args ]
131
139
}
140
+
132
141
return [ 'tsc' , [ '--noEmit' ] ]
133
142
} ,
134
143
} ,
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ export type TscConfig =
11
11
tsconfigPath : string
12
12
/** root path of cwd */
13
13
root : string
14
+ /** root path of cwd */
15
+ buildMode : boolean
14
16
} >
15
17
16
18
/** vue-tsc checker configuration */
You can’t perform that action at this time.
0 commit comments