@@ -6,7 +6,7 @@ import createDebug from 'debug'
6
6
import type { EncodedSourceMap } from '@jridgewell/trace-mapping'
7
7
import type { DebuggerOptions , FetchResult , ViteNodeResolveId , ViteNodeServerOptions } from './types'
8
8
import { shouldExternalize } from './externalize'
9
- import { normalizeModuleId , toArray , toFilePath } from './utils'
9
+ import { normalizeModuleId , toArray , toFilePath , withTrailingSlash } from './utils'
10
10
import { Debugger } from './debug'
11
11
import { withInlineSourcemap } from './source-map'
12
12
@@ -106,7 +106,7 @@ export class ViteNodeServer {
106
106
}
107
107
108
108
async resolveId ( id : string , importer ?: string , transformMode ?: 'web' | 'ssr' ) : Promise < ViteNodeResolveId | null > {
109
- if ( importer && ! importer . startsWith ( this . server . config . root ) )
109
+ if ( importer && ! importer . startsWith ( withTrailingSlash ( this . server . config . root ) ) )
110
110
importer = resolve ( this . server . config . root , importer )
111
111
const mode = transformMode ?? ( ( importer && this . getTransformMode ( importer ) ) || 'ssr' )
112
112
return this . server . pluginContainer . resolveId ( id , importer , { ssr : mode === 'ssr' } )
@@ -182,7 +182,7 @@ export class ViteNodeServer {
182
182
const cacheDir = this . options . deps ?. cacheDir
183
183
184
184
if ( cacheDir && id . includes ( cacheDir ) ) {
185
- if ( ! id . startsWith ( this . server . config . root ) )
185
+ if ( ! id . startsWith ( withTrailingSlash ( this . server . config . root ) ) )
186
186
id = join ( this . server . config . root , id )
187
187
const timeout = setTimeout ( ( ) => {
188
188
throw new Error ( `ViteNodeServer: ${ id } not found. This is a bug, please report it.` )
0 commit comments