Repository navigation
Conversation
fixes vitejs#23981 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
This branch has not been deployed
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.
fixes #23981
Since #17988,
traverseNodeswalks into<template>content, so a<link rel="stylesheet">inside a template hits the same branch as a link in the document. In build the tag is removed and its CSS is bundled into the<head>stylesheet, so a declarative shadow DOM template loses its styles. Dev leaves the link as is.This skips the CSS import for links inside a template. They go through
processAssetUrllike links withmediaordisabled(#6748), so the href is rewritten and the tag stays in the template. The file is emitted as a plain asset, which means CSS plugins don't run on it and a small file gets inlined as adata:URL.I added a
<template shadowrootmode="open">with a stylesheet link to theassetsplayground. The tests check the color inside the shadow root and that the built HTML keeps the link in the template. Both fail without the fix.I used Claude Code to trace the code path and draft the change and tests. I reviewed it myself: I read the
linkbranch inhtml.tsand ran the new tests with and without the fix.