Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(manifest): use style.css as a key for the style file for cssCodesplit: false #18820

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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