From 8b24992f6d905c6d1188830087f8d59a14b3f544 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 9 Sep 2022 11:04:23 +0100 Subject: [PATCH] fix(nuxi): don't include an array of paths within an array --- packages/nuxi/src/utils/cjs.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/nuxi/src/utils/cjs.ts b/packages/nuxi/src/utils/cjs.ts index 90463fb6135..ff048055f96 100644 --- a/packages/nuxi/src/utils/cjs.ts +++ b/packages/nuxi/src/utils/cjs.ts @@ -3,14 +3,16 @@ import { pathToFileURL } from 'node:url' import { normalize, dirname } from 'pathe' export function getModulePaths (paths?: string | string[]): string[] { - return [ - // @ts-ignore - global.__NUXT_PREPATHS__, - ...(paths ? [] : Array.isArray(paths) ? paths : [paths]), - process.cwd(), - // @ts-ignore - global.__NUXT_PATHS__ - ].filter(Boolean) + return ([] as Array) + .concat( + // @ts-expect-error global object + global.__NUXT_PREPATHS__, + paths, + process.cwd(), + // @ts-expect-error global object + global.__NUXT_PATHS__ + ) + .filter(Boolean) as string[] } const _require = createRequire(process.cwd())