File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
testing/test-setup-config/src/lib Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1+ import path from 'node:path' ;
2+ import { fileURLToPath } from 'node:url' ;
13import { loadConfig } from 'tsconfig-paths' ;
24import type { Alias , AliasOptions } from 'vite' ;
35
46export function tsconfigPathAliases ( projectRootUrl ?: URL ) : AliasOptions {
57 const tsconfigPath = projectRootUrl
6- ? new URL ( 'tsconfig.base.json' , projectRootUrl ) . pathname
8+ ? path . resolve ( fileURLToPath ( projectRootUrl ) , 'tsconfig.base.json' )
79 : 'tsconfig.base.json' ;
810 const result = loadConfig ( tsconfigPath ) ;
911 if ( result . resultType === 'failed' ) {
@@ -18,7 +20,7 @@ export function tsconfigPathAliases(projectRootUrl?: URL): AliasOptions {
1820 ( [ importPath , relativePath ] ) : Alias => ( {
1921 find : importPath ,
2022 replacement : projectRootUrl
21- ? new URL ( relativePath , projectRootUrl ) . pathname
23+ ? path . resolve ( fileURLToPath ( projectRootUrl ) , relativePath )
2224 : new URL ( `../${ relativePath } ` , import . meta. url ) . pathname ,
2325 } ) ,
2426 ) ;
You can’t perform that action at this time.
0 commit comments