mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
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',
|
||||
builder: 'untyped',
|
||||
defaults: {
|
||||
srcDir: '/<srcDir>/',
|
||||
workspaceDir: '/<workspaceDir>/',
|
||||
rootDir: '/<rootDir>/',
|
||||
vite: {
|
||||
base: '/'
|
||||
|
@ -136,10 +136,10 @@ export default defineUntypedSchema({
|
||||
$default: ['node_modules'],
|
||||
$resolve: async (val: string[] | undefined, get): Promise<string[]> => {
|
||||
const rootDir = await get('rootDir') as string
|
||||
return [
|
||||
...await Promise.all((val || []).map(async (dir: string) => resolve(rootDir, dir))),
|
||||
resolve(process.cwd(), 'node_modules')
|
||||
]
|
||||
return [...new Set([
|
||||
...(val || []).map((dir: string) => resolve(rootDir, dir)),
|
||||
resolve(rootDir, 'node_modules')
|
||||
])]
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -92,14 +92,14 @@ export default defineUntypedSchema({
|
||||
allow: {
|
||||
$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]
|
||||
return [
|
||||
return [...new Set([
|
||||
buildDir,
|
||||
srcDir,
|
||||
rootDir,
|
||||
workspaceDir,
|
||||
...(modulesDir),
|
||||
...val ?? []
|
||||
]
|
||||
])]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user