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(html): fix css disorder when building multiple entry html #19143

Merged
merged 2 commits into from
Feb 4, 2025

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?

packages/vite/src/node/plugins/html.ts Outdated Show resolved Hide resolved
@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.

packages/vite/src/node/plugins/html.ts Show resolved Hide resolved
@patak-dev
Copy link
Member

/ecosystem-ci run

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-dev patak-dev 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-dev patak-dev merged commit e7b4ba3 into vitejs:main Feb 4, 2025
17 checks passed
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