From 794449f4695849b3ff10782da537d1d31c19a303 Mon Sep 17 00:00:00 2001 From: Julien Huang Date: Sun, 18 Jun 2023 18:43:39 +0200 Subject: [PATCH] docs: document `parallel` option on plugins (#21622) --- docs/2.guide/2.directory-structure/1.plugins.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/2.guide/2.directory-structure/1.plugins.md b/docs/2.guide/2.directory-structure/1.plugins.md index 836ce68cecf1..651b73fb1cbc 100644 --- a/docs/2.guide/2.directory-structure/1.plugins.md +++ b/docs/2.guide/2.directory-structure/1.plugins.md @@ -85,6 +85,20 @@ This is useful in situations where you have a plugin that depends on another plu In case you're new to 'alphabetical' numbering, remember that filenames are sorted as strings, not as numeric values. For example, `10.myPlugin.ts` would come before `2.myOtherPlugin.ts`. This is why the example prefixes single digit numbers with `0`. :: +## Loading strategy + +By default, Nuxt loads plugins sequentially. You can define a plugin as `parallel` so Nuxt won't wait the end of the plugin's execution before loading the next plugin. + +```ts +export default defineNuxtPlugin({ + name: 'my-plugin', + parallel: true, + async setup (nuxtApp) { + // the next plugin will be executed immediatly + } +}) +``` + ## Using Composables Within Plugins You can use [composables](/docs/guide/directory-structure/composables) within Nuxt plugins: