mirror of https://github.com/nuxt/nuxt.git
fix(schema): use `rootDir`, not `process.cwd`, for `modulesDir` (#25766)
This commit is contained in:
parent
29b338f8aa
commit
37d24eed7d
|
@ -9,6 +9,8 @@ export default defineBuildConfig({
|
||||||
name: 'config',
|
name: 'config',
|
||||||
builder: 'untyped',
|
builder: 'untyped',
|
||||||
defaults: {
|
defaults: {
|
||||||
|
srcDir: '/<srcDir>/',
|
||||||
|
workspaceDir: '/<workspaceDir>/',
|
||||||
rootDir: '/<rootDir>/',
|
rootDir: '/<rootDir>/',
|
||||||
vite: {
|
vite: {
|
||||||
base: '/'
|
base: '/'
|
||||||
|
|
|
@ -136,10 +136,10 @@ export default defineUntypedSchema({
|
||||||
$default: ['node_modules'],
|
$default: ['node_modules'],
|
||||||
$resolve: async (val: string[] | undefined, get): Promise<string[]> => {
|
$resolve: async (val: string[] | undefined, get): Promise<string[]> => {
|
||||||
const rootDir = await get('rootDir') as string
|
const rootDir = await get('rootDir') as string
|
||||||
return [
|
return [...new Set([
|
||||||
...await Promise.all((val || []).map(async (dir: string) => resolve(rootDir, dir))),
|
...(val || []).map((dir: string) => resolve(rootDir, dir)),
|
||||||
resolve(process.cwd(), 'node_modules')
|
resolve(rootDir, 'node_modules')
|
||||||
]
|
])]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -92,14 +92,14 @@ export default defineUntypedSchema({
|
||||||
allow: {
|
allow: {
|
||||||
$resolve: async (val: string[] | undefined, get) => {
|
$resolve: async (val: string[] | undefined, get) => {
|
||||||
const [buildDir, srcDir, rootDir, workspaceDir, modulesDir] = await Promise.all([get('buildDir'), get('srcDir'), get('rootDir'), get('workspaceDir'), get('modulesDir')]) as [string, string, string, string, string]
|
const [buildDir, srcDir, rootDir, workspaceDir, modulesDir] = await Promise.all([get('buildDir'), get('srcDir'), get('rootDir'), get('workspaceDir'), get('modulesDir')]) as [string, string, string, string, string]
|
||||||
return [
|
return [...new Set([
|
||||||
buildDir,
|
buildDir,
|
||||||
srcDir,
|
srcDir,
|
||||||
rootDir,
|
rootDir,
|
||||||
workspaceDir,
|
workspaceDir,
|
||||||
...(modulesDir),
|
...(modulesDir),
|
||||||
...val ?? []
|
...val ?? []
|
||||||
]
|
])]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue