Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jan 2, 2024
1 parent 85ddca2 commit 6a0ef59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/node/ssr/ssrFetchModule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { pathToFileURL } from 'node:url'
import { posix } from 'node:path'
import type { ModuleNode, TransformResult, ViteDevServer } from '..'
import type { PackageCache } from '../packages'
import type { InternalResolveOptionsWithOverrideConditions } from '../plugins/resolve'
Expand All @@ -22,6 +21,8 @@ interface FetchModuleOptions {
| ((mod: ModuleNode, result: TransformResult) => TransformResult)
}

const DRIVE_REGEXP = /^[A-Za-z]:/

// TODO: return "type" when externalized
export async function ssrFetchModule(
server: ViteDevServer,
Expand All @@ -36,7 +37,7 @@ export async function ssrFetchModule(

// if there is no importer, it's an entry point, so we know it's not external
// ssr bare imports are always externalized because they are transformed like that on purpose
if (importer && id[0] !== '.' && !posix.isAbsolute(id)) {
if (importer && id[0] !== '.' && id[0] !== '/' && !DRIVE_REGEXP.test(id)) {
const {
isProduction,
resolve: { dedupe, preserveSymlinks },
Expand Down

0 comments on commit 6a0ef59

Please sign in to comment.