From d28189eb58cd462f5540f5e8ba420b9e4e34a334 Mon Sep 17 00:00:00 2001 From: Julien Huang Date: Mon, 4 Sep 2023 10:33:53 +0200 Subject: [PATCH] docs: describe `env` object for nuxt plugins (#22963) --- docs/2.guide/2.directory-structure/1.plugins.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/2.guide/2.directory-structure/1.plugins.md b/docs/2.guide/2.directory-structure/1.plugins.md index d6589203c3..015250f586 100644 --- a/docs/2.guide/2.directory-structure/1.plugins.md +++ b/docs/2.guide/2.directory-structure/1.plugins.md @@ -61,6 +61,12 @@ export default defineNuxtPlugin({ }) ``` +You can also use the `env` property to define the environments in which your plugin will run. + +- **islands** + - **default**: `true` + - **description**: You can set this value to `false` if you don't want the plugin to run when rendering server-only or island components. + ::alert If you are using an object-syntax plugin, the properties may be statically analyzed in future to produce a more optimized build. So you should not define them at runtime. For example, setting `enforce: process.server ? 'pre' : 'post'` would defeat any future optimization Nuxt is able to do for your plugins. ::