mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix(kit): don't require nuxt context when resolving path (#8504)
This commit is contained in:
parent
ea6ebd0b1f
commit
2284525662
@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url'
|
|||||||
import { basename, dirname, resolve, join, normalize, isAbsolute } from 'pathe'
|
import { basename, dirname, resolve, join, normalize, isAbsolute } from 'pathe'
|
||||||
import { globby } from 'globby'
|
import { globby } from 'globby'
|
||||||
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
||||||
import { tryUseNuxt, useNuxt } from './context'
|
import { tryUseNuxt } from './context'
|
||||||
import { tryResolveModule } from './internal/cjs'
|
import { tryResolveModule } from './internal/cjs'
|
||||||
import { isIgnored } from './ignore'
|
import { isIgnored } from './ignore'
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ export async function resolvePath (path: string, opts: ResolvePathOptions = {}):
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use current nuxt options
|
// Use current nuxt options
|
||||||
const nuxt = useNuxt()
|
const nuxt = tryUseNuxt()
|
||||||
const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd())
|
const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd())
|
||||||
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : ['.ts', '.mjs', '.cjs', '.json'])
|
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : ['.ts', '.mjs', '.cjs', '.json'])
|
||||||
const modulesDir = nuxt ? nuxt.options.modulesDir : []
|
const modulesDir = nuxt ? nuxt.options.modulesDir : []
|
||||||
|
Loading…
Reference in New Issue
Block a user