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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thy486
Copy link

@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
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
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants