Skip to content

Commit 3a73e48

Browse files
authoredMar 24, 2024··
docs: clarify enforce vs hook.order (#16226)
1 parent 6a07243 commit 3a73e48

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎docs/guide/api-plugin.md

+2
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ A Vite plugin can additionally specify an `enforce` property (similar to webpack
480480
- User plugins with `enforce: 'post'`
481481
- Vite post build plugins (minify, manifest, reporting)
482482
483+
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).
484+
483485
## Conditional Application
484486
485487
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'`:

‎packages/vite/src/node/plugin.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ import type { PreviewServerHook } from './preview'
3939
*/
4040
export interface Plugin<A = any> extends RollupPlugin<A> {
4141
/**
42-
* Enforce plugin invocation tier similar to webpack loaders.
42+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
43+
* is still subject to the `order` property in the hook object.
4344
*
4445
* Plugin invocation order:
4546
* - alias resolution

0 commit comments

Comments
 (0)
Please sign in to comment.