Skip to content

Commit

Permalink
fix(vite): use pathToFileURL for externals (nuxt#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Oct 12, 2021
1 parent f0d23d1 commit 47ea41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/dev-bundler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { builtinModules } from 'module'
import { pathToFileURL } from 'url'
import { join } from 'pathe'
import * as vite from 'vite'
import { hashId, uniq } from './utils'
Expand Down Expand Up @@ -57,7 +58,7 @@ async function transformRequest (opts: TransformOptions, id: string) {
// Externals
if (isExternal(opts, id)) {
return {
code: `(global, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) => import('${id}').then(r => { ssrExportAll(r) })`,
code: `(global, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) => import('${(pathToFileURL(id))}').then(r => { ssrExportAll(r) })`,
deps: [],
dynamicDeps: []
}
Expand Down

0 comments on commit 47ea41d

Please sign in to comment.