You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/build-options.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -251,6 +251,8 @@ Whether to generate a manifest file that contains a mapping of non-hashed asset
251
251
252
252
When the value is a string, it will be used as the manifest file path relative to `build.outDir`. When set to `true`, the path would be `.vite/manifest.json`.
253
253
254
+
If you are writing a plugin and need to inspect each output chunk or asset's related CSS and static assets during the build, you can also use [`viteMetadata` output bundle metadata API](/guide/api-plugin#output-bundle-metadata).
Copy file name to clipboardExpand all lines: docs/guide/api-plugin.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -470,6 +470,44 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo
470
470
}
471
471
```
472
472
473
+
## Output Bundle Metadata
474
+
475
+
During build, Vite augments Rolldown's build output objects with a Vite-specific `viteMetadata` field.
476
+
477
+
This is available through:
478
+
479
+
-`RenderedChunk` (for example in`renderChunk` and `augmentChunkHash`)
480
+
-`OutputChunk` and `OutputAsset` (for example in`generateBundle` and `writeBundle`)
481
+
482
+
`viteMetadata` provides:
483
+
484
+
-`viteMetadata.importedCss: Set<string>`
485
+
-`viteMetadata.importedAssets: Set<string>`
486
+
487
+
This is useful when writing plugins that need to inspect emitted CSS and static assets without relying on [`build.manifest`](/config/build-options#build-manifest).
A Vite plugin can additionally specify an `enforce`property (similar to webpack loaders) to adjust its application order. The value of`enforce` can be either `"pre"` or `"post"`. The resolved plugins will be in the following order:
0 commit comments