Skip to content

Commit

Permalink
fix(nuxi): don't include an array of paths within an array (nuxt#7378)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Sep 9, 2022
1 parent f698d7a commit e05f8ee
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/nuxi/src/utils/cjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>)
.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())
Expand Down

0 comments on commit e05f8ee

Please sign in to comment.