Skip to content

Commit

Permalink
fix(manifest): use style.css as a key for the style file for `cssCo…
Browse files Browse the repository at this point in the history
…desplit: false` (#18820)
  • Loading branch information
sapphi-red authored Nov 28, 2024
1 parent 51a5569 commit ec51115
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/guide/backend-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ If you need a custom integration, you can follow the steps in this guide to conf
- The manifest has a `Record<name, chunk>` structure
- For entry or dynamic entry chunks, the key is the relative src path from project root.
- For non entry chunks, the key is the base name of the generated file prefixed with `_`.
- For the CSS file generated when [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) is `false`, the key is `style.css`.
- Chunks will contain information on its static and dynamic imports (both are keys that map to the corresponding chunk in the manifest), and also its corresponding CSS and asset files (if any).

4. You can use this file to render links or preload directives with hashed filenames.
Expand Down
3 changes: 3 additions & 0 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
name: getCssBundleName(),
type: 'asset',
source: extractedCss,
// this file is an implicit entry point, use `style.css` as the original file name
// this name is also used as a key in the manifest
originalFileName: 'style.css',
})
}
}
Expand Down

0 comments on commit ec51115

Please sign in to comment.