Repository navigation
fix: link the stylesheets of a lazily loaded template with no client code - #316
Merged
Merged
Conversation
…code A load entry's css is collected in the post plugin's generateBundle by walking the entry chunk's imports, but vite's css plugin has run by then: a template whose client chunk is pure css is pruned, its css folded into static importers only, and the load entry reaches it through a dynamic import that keeps just the pruned chunk's name. The pre plugin now collects each load entry's css before that pass, so the stylesheet flushes with the html it styles instead of arriving once the module script runs, with the html painted unstyled until then. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: fafb47f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A lazily loaded template's stylesheets are collected from the client bundle graph to flush with its html, but that ran after vite's css plugin: a template whose client chunk is pure css is pruned there, its css folded into static importers only, and the load entry reaches it through a dynamic import that keeps just the pruned chunk's name. So a lazy template with a
<style>and no client code lost its stylesheet link and painted unstyled until its module script ran. The pre plugin now collects each load entry's css before that pass. Adds a fixture for the scriptless case.🤖 Generated with Claude Code