Skip to content

fix(html): fix css disorder when building multiple entry html#19143

Merged
patak-cat merged 2 commits intovitejs:mainfrom
thy486:fix-multiple-entries-css-import
Feb 4, 2025
Merged

fix(html): fix css disorder when building multiple entry html#19143
patak-cat merged 2 commits intovitejs:mainfrom
thy486:fix-multiple-entries-css-import

Conversation

@thy486
Copy link
Contributor

@thy486 thy486 commented Jan 6, 2025

Description

When Vite collects css tags, it will cache the analyzed css chunk. But when collecting css tags for the second time, since the css chunk has been cached, Vite will no longer analyze the deep import, which will ignore the results of the previous import, causing the css to be out of order.

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you create a reproduction so that I can understand when this happens?

@sapphi-red sapphi-red added feat: html p3-minor-bug An edge case that only affects very specific usage (priority) labels Jan 7, 2025
@thy486
Copy link
Contributor Author

thy486 commented Jan 7, 2025

Would you create a reproduction so that I can understand when this happens?

Reproduction

https://stackblitz.com/edit/vitejs-vite-f9kv8tr4

The meaning of parentImports is: It is passed in by the parent importer and is used to collect the css used by imported modules and itself

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reproduction.

@patak-cat
Copy link
Member

/ecosystem-ci run

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2025

Open in Stackblitz

npm i https://pkg.pr.new/vite@19143

commit: cf9cfc0

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on cf9cfc0: Open

suite result latest scheduled
astro failure failure
histoire failure failure
ladle failure failure
nuxt failure success
previewjs failure failure
qwik failure failure
redwoodjs failure failure
vitest failure failure
waku failure failure

analogjs, laravel, marko, quasar, rakkas, react-router, storybook, sveltekit, unocss, vike, vite-environment-examples, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vuepress

Copy link
Member

@patak-cat patak-cat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the new Nuxt fail is due to the corepack issue)

@patak-cat patak-cat merged commit e7b4ba3 into vitejs:main Feb 4, 2025
2 checks passed
@thy486 thy486 deleted the fix-multiple-entries-css-import branch April 21, 2025 07:04
moonlitusun pushed a commit to moonlitusun/vite that referenced this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: html p3-minor-bug An edge case that only affects very specific usage (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants