From 2284525662cdf06cdf94dcfc2ab4a9fec20b5716 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 26 Oct 2022 15:55:11 +0200 Subject: [PATCH] fix(kit): don't require nuxt context when resolving path (#8504) --- packages/kit/src/resolve.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kit/src/resolve.ts b/packages/kit/src/resolve.ts index 6ccb4c56af..a9e6d3300b 100644 --- a/packages/kit/src/resolve.ts +++ b/packages/kit/src/resolve.ts @@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url' import { basename, dirname, resolve, join, normalize, isAbsolute } from 'pathe' import { globby } from 'globby' import { resolveAlias as _resolveAlias } from 'pathe/utils' -import { tryUseNuxt, useNuxt } from './context' +import { tryUseNuxt } from './context' import { tryResolveModule } from './internal/cjs' import { isIgnored } from './ignore' @@ -34,7 +34,7 @@ export async function resolvePath (path: string, opts: ResolvePathOptions = {}): } // Use current nuxt options - const nuxt = useNuxt() + const nuxt = tryUseNuxt() const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd()) const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : ['.ts', '.mjs', '.cjs', '.json']) const modulesDir = nuxt ? nuxt.options.modulesDir : []