fix(nuxi): don't include an array of paths within an array (#7378)

This commit is contained in:
Daniel Roe 2022-09-09 11:17:44 +01:00 committed by GitHub
parent f698d7ad61
commit e05f8ee126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,14 +3,16 @@ import { pathToFileURL } from 'node:url'
import { normalize, dirname } from 'pathe' import { normalize, dirname } from 'pathe'
export function getModulePaths (paths?: string | string[]): string[] { export function getModulePaths (paths?: string | string[]): string[] {
return [ return ([] as Array<string | undefined>)
// @ts-ignore .concat(
// @ts-expect-error global object
global.__NUXT_PREPATHS__, global.__NUXT_PREPATHS__,
...(paths ? [] : Array.isArray(paths) ? paths : [paths]), paths,
process.cwd(), process.cwd(),
// @ts-ignore // @ts-expect-error global object
global.__NUXT_PATHS__ global.__NUXT_PATHS__
].filter(Boolean) )
.filter(Boolean) as string[]
} }
const _require = createRequire(process.cwd()) const _require = createRequire(process.cwd())