From 3a73e485cd4c08954fcb06698b5f721dea6e9f44 Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Sun, 24 Mar 2024 07:04:31 +0100 Subject: [PATCH] docs: clarify enforce vs hook.order (#16226) --- docs/guide/api-plugin.md | 2 ++ packages/vite/src/node/plugin.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/guide/api-plugin.md b/docs/guide/api-plugin.md index 4d8066ff4dddb3..7f77b7b0464506 100644 --- a/docs/guide/api-plugin.md +++ b/docs/guide/api-plugin.md @@ -480,6 +480,8 @@ A Vite plugin can additionally specify an `enforce` property (similar to webpack - User plugins with `enforce: 'post'` - Vite post build plugins (minify, manifest, reporting) +Note that this is separate from hooks ordering, those are still separately subject to their `order` attribute [as usual for Rollup hooks](https://rollupjs.org/plugin-development/#build-hooks). + ## Conditional Application By default plugins are invoked for both serve and build. In cases where a plugin needs to be conditionally applied only during serve or build, use the `apply` property to only invoke them during `'build'` or `'serve'`: diff --git a/packages/vite/src/node/plugin.ts b/packages/vite/src/node/plugin.ts index 63b7598908c984..bf6eb069067bdc 100644 --- a/packages/vite/src/node/plugin.ts +++ b/packages/vite/src/node/plugin.ts @@ -39,7 +39,8 @@ import type { PreviewServerHook } from './preview' */ export interface Plugin extends RollupPlugin { /** - * Enforce plugin invocation tier similar to webpack loaders. + * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering + * is still subject to the `order` property in the hook object. * * Plugin invocation order: * - alias resolution