Skip to content

Commit

Permalink
chore: use isAbsolute to check if path should be resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Feb 20, 2022
1 parent b5e538e commit 93f59a0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/vite-node/src/client.ts
@@ -1,9 +1,9 @@
import { createRequire } from 'module'
import { fileURLToPath, pathToFileURL } from 'url'
import vm from 'vm'
import { dirname, resolve } from 'pathe'
import { dirname, isAbsolute, resolve } from 'pathe'
import { isNodeBuiltin } from 'mlly'
import { isPrimitive, isWindows, normalizeId, slash, toFilePath } from './utils'
import { isPrimitive, normalizeId, slash, toFilePath } from './utils'
import type { ModuleCache, ViteNodeRunnerOptions } from './types'

export const DEFAULT_REQUEST_STUBS = {
Expand Down Expand Up @@ -143,10 +143,7 @@ export class ViteNodeRunner {
if (isNodeBuiltin(dep))
return false

if (isWindows)
return !/^\w:\//i.test(dep) && !dep.startsWith('/')

return !dep.startsWith('/')
return !isAbsolute(dep)
}

/**
Expand Down

0 comments on commit 93f59a0

Please sign in to comment.