File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1983,7 +1983,9 @@ describe('loadConfigFromFile', () => {
19831983 const config = await resolveConfig ( { root : tempDir } , 'serve' )
19841984
19851985 expect ( config . cacheDir ) . toBe (
1986- normalizePath ( path . resolve ( tempDir , 'node_modules/.vite' ) ) ,
1986+ normalizePath (
1987+ path . resolve ( fs . realpathSync . native ( tempDir ) , 'node_modules/.vite' ) ,
1988+ ) ,
19871989 )
19881990 } )
19891991
@@ -1994,7 +1996,7 @@ describe('loadConfigFromFile', () => {
19941996 const config = await resolveConfig ( { root : tempDir } , 'serve' )
19951997
19961998 expect ( config . cacheDir ) . toBe (
1997- normalizePath ( path . resolve ( tempDir , '.vite' ) ) ,
1999+ normalizePath ( path . resolve ( fs . realpathSync . native ( tempDir ) , '.vite' ) ) ,
19982000 )
19992001 } )
20002002 } )
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ import {
104104 normalizeAlias ,
105105 normalizePath ,
106106 resolveHostname ,
107+ safeRealpathSync ,
107108 setupRollupOptionCompat ,
108109} from './utils'
109110import {
@@ -1593,9 +1594,13 @@ export async function resolveConfig(
15931594 }
15941595
15951596 // resolve root
1596- const resolvedRoot = normalizePath (
1597- config . root ? path . resolve ( config . root ) : process . cwd ( ) ,
1598- )
1597+ let nonNormalizedResolvedRoot = config . root
1598+ ? path . resolve ( config . root )
1599+ : process . cwd ( )
1600+ try {
1601+ nonNormalizedResolvedRoot = safeRealpathSync ( nonNormalizedResolvedRoot )
1602+ } catch { }
1603+ const resolvedRoot = normalizePath ( nonNormalizedResolvedRoot )
15991604
16001605 checkBadCharactersInPath (
16011606 'The project root' ,
You can’t perform that action at this time.
0 commit comments