feat(nuxt): allow configuring plugins directory (#7981)

This commit is contained in:
Daniel Roe 2022-10-07 09:13:12 +02:00 committed by GitHub
parent 2299fdc70a
commit 1477d3759e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -104,8 +104,8 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
...(config.plugins || []),
...config.srcDir
? await resolveFiles(config.srcDir, [
'plugins/*.{ts,js,mjs,cjs,mts,cts}',
'plugins/*/index.*{ts,js,mjs,cjs,mts,cts}'
`${config.dir?.plugins || 'plugins'}/*.{ts,js,mjs,cjs,mts,cts}`,
`${config.dir?.plugins || 'plugins'}/*/index.*{ts,js,mjs,cjs,mts,cts}`
])
: []
].map(plugin => normalizePlugin(plugin as NuxtPlugin)))

View File

@ -503,6 +503,11 @@ export default defineUntypedSchema({
* @version 3
*/
pages: 'pages',
/**
* The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
* @version 3
*/
plugins: 'plugins',
/**
* The directory containing your static files, which will be directly accessible via the Nuxt server
* and copied across into your `dist` folder when your app is generated.