Skip to content

Commit ec51115

Browse files
authored
fix(manifest): use style.css as a key for the style file for cssCodesplit: false (#18820)
1 parent 51a5569 commit ec51115

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/guide/backend-integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ If you need a custom integration, you can follow the steps in this guide to conf
9898
- The manifest has a `Record<name, chunk>` structure
9999
- For entry or dynamic entry chunks, the key is the relative src path from project root.
100100
- For non entry chunks, the key is the base name of the generated file prefixed with `_`.
101+
- For the CSS file generated when [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) is `false`, the key is `style.css`.
101102
- 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).
102103

103104
4. You can use this file to render links or preload directives with hashed filenames.

packages/vite/src/node/plugins/css.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
939939
name: getCssBundleName(),
940940
type: 'asset',
941941
source: extractedCss,
942+
// this file is an implicit entry point, use `style.css` as the original file name
943+
// this name is also used as a key in the manifest
944+
originalFileName: 'style.css',
942945
})
943946
}
944947
}

0 commit comments

Comments
 (0)