mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(vite): use pathToFileURL for externals (#819)
This commit is contained in:
parent
f0d23d13d4
commit
47ea41dadb
@ -1,4 +1,5 @@
|
|||||||
import { builtinModules } from 'module'
|
import { builtinModules } from 'module'
|
||||||
|
import { pathToFileURL } from 'url'
|
||||||
import { join } from 'pathe'
|
import { join } from 'pathe'
|
||||||
import * as vite from 'vite'
|
import * as vite from 'vite'
|
||||||
import { hashId, uniq } from './utils'
|
import { hashId, uniq } from './utils'
|
||||||
@ -57,7 +58,7 @@ async function transformRequest (opts: TransformOptions, id: string) {
|
|||||||
// Externals
|
// Externals
|
||||||
if (isExternal(opts, id)) {
|
if (isExternal(opts, id)) {
|
||||||
return {
|
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: [],
|
deps: [],
|
||||||
dynamicDeps: []
|
dynamicDeps: []
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user