mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(vite): remove relative vite workaround (#1646)
This commit is contained in:
parent
875deefafc
commit
2166661b17
@ -1,4 +1,6 @@
|
||||
import { pathToFileURL } from 'url'
|
||||
import { existsSync } from 'fs'
|
||||
import { resolve } from 'pathe'
|
||||
import * as vite from 'vite'
|
||||
import { ExternalsOptions, isExternal as _isExternal, ExternalsDefaults } from 'externality'
|
||||
import { hashId, uniq } from './utils'
|
||||
@ -61,7 +63,10 @@ async function transformRequest (opts: TransformOptions, id: string) {
|
||||
}
|
||||
} else if (!id.includes('entry') && id.startsWith('/')) {
|
||||
// Relative to the root directory
|
||||
id = '.' + id
|
||||
const resolvedPath = resolve(opts.viteServer.config.root, '.' + id)
|
||||
if (existsSync(resolvedPath)) {
|
||||
id = resolvedPath
|
||||
}
|
||||
}
|
||||
|
||||
if (await isExternal(opts, id)) {
|
||||
|
Loading…
Reference in New Issue
Block a user