From c6b82a8cb08cd6ce630dd49a9a2660c2984e4f38 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Thu, 28 Nov 2024 18:11:33 +0900 Subject: [PATCH 1/2] fix(manifest): use `style.css` as a key for the style file for `cssCodesplit: false` --- packages/vite/src/node/plugins/css.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 3f3e35fb962f49..8c484b54e28e4a 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -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', }) } } From 32fd4761aa757c67b2d36dca77ab6a5b1972c783 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Thu, 28 Nov 2024 18:16:15 +0900 Subject: [PATCH 2/2] docs: add information --- docs/guide/backend-integration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/guide/backend-integration.md b/docs/guide/backend-integration.md index 5a6cb5ce73a88f..5f3cc938774530 100644 --- a/docs/guide/backend-integration.md +++ b/docs/guide/backend-integration.md @@ -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` 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.