@@ -2,7 +2,11 @@ import _debug from 'debug'
2
2
import * as fs from 'fs'
3
3
import globRex from 'globrex'
4
4
import { resolve } from 'path'
5
- import type { TSConfckParseOptions , TSConfckParseResult } from 'tsconfck'
5
+ import type {
6
+ TSConfckParseNativeResult ,
7
+ TSConfckParseOptions ,
8
+ TSConfckParseResult ,
9
+ } from 'tsconfck'
6
10
import type { CompilerOptions } from 'typescript'
7
11
import { inspect } from 'util'
8
12
import { normalizePath , Plugin , searchForWorkspaceRoot } from 'vite'
@@ -218,7 +222,14 @@ export default (opts: PluginOptions = {}): Plugin => {
218
222
compilerOptions ?: CompilerOptions
219
223
}
220
224
221
- function resolvePathsRootDir ( project : TSConfckParseResult ) : string {
225
+ function resolvePathsRootDir (
226
+ project : TSConfckParseResult | TSConfckParseNativeResult
227
+ ) : string {
228
+ if ( 'result' in project ) {
229
+ return (
230
+ project . result . options ?. pathsBasePath ?? dirname ( project . tsconfigFile )
231
+ )
232
+ }
222
233
const baseUrl = ( project . tsconfig as TsConfig ) . compilerOptions ?. baseUrl
223
234
if ( baseUrl ) {
224
235
return baseUrl
@@ -229,7 +240,9 @@ export default (opts: PluginOptions = {}): Plugin => {
229
240
return dirname ( ( projectWithPaths ?? project ) . tsconfigFile )
230
241
}
231
242
232
- function createResolver ( project : TSConfckParseResult ) : Resolver | null {
243
+ function createResolver (
244
+ project : TSConfckParseResult | TSConfckParseNativeResult
245
+ ) : Resolver | null {
233
246
const configPath = normalizePath ( project . tsconfigFile )
234
247
const config = project . tsconfig as TsConfig
235
248
0 commit comments