diff --git a/packages/nuxt/src/core/app.ts b/packages/nuxt/src/core/app.ts index 9baf3bed20..aa05a3ce2f 100644 --- a/packages/nuxt/src/core/app.ts +++ b/packages/nuxt/src/core/app.ts @@ -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))) diff --git a/packages/schema/src/config/_common.ts b/packages/schema/src/config/_common.ts index 098e1ceee7..903a3ec82a 100644 --- a/packages/schema/src/config/_common.ts +++ b/packages/schema/src/config/_common.ts @@ -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.