Repository navigation
fix(pages): link CSS that island and Markdown pages reach through components - #481
Merged
Merged
Conversation
…ponents In production, island and Markdown pages only got the CSS their page and layout files import directly. A stylesheet imported by a component that a layout renders was missing, and when no file imported CSS directly the islands client entry was not built at all, so no page got a stylesheet. - Build the islands client entry for every app with island or Markdown pages, replacing the text scan in needsIslandClientBundle. - Record the stylesheets that island pages and their layouts reach through static imports from the server build's module graph, and import them in the islands client entry. This covers aliases, packages, CSS modules and Vue/Svelte style blocks, and keeps the CSS order of dev. - Keep CSS modules that the entry imports (Vite marks them side-effect free), keep Vue scoped styles whose component is not in the client bundle, and load Svelte styles through vite-plugin-svelte's own id so a rule is not emitted twice. - Without islands, the entry only holds the CSS imports, so no hydration runtime is bundled. The React and Solid entry is now added only to the client build. Fixes #452 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-island-transitive-css-void-cloud.voidzero-docs.workers.dev (commit 331e23b)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 331e23bff7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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 #452
Problem
vp devappliedglobal.css. A production build did not:<style>or island import (a text scan). With CSS only reachable through a component, no client build ran, so pages got no<link rel="stylesheet">.Fix
hasIslandPages). It replaces theneedsIslandClientBundletext scan, which only the adapters used.?inline/?url/?raware skipped.*.module.css, Vue<style module>) are kept. Vite marks them side-effect free, so the bare import would drop them.cssScopeTois cleared for the recorded ids, because the component itself is not in the client bundle.?svelte&type=styleid, compiled through the existing island-style loader, so the same rule is not emitted twice in mixed apps.<link>, no<script>.Behaviour changes worth knowing
<style scoped>used to fail the build (PARSE_ERRORon...&scoped=true). It now builds and links the CSS.playground/markdown-blog: same CSS rules, but@void/md/theme.css(imported in the script) now comes before the layout's<style>, which is Vue's normal order.Known limit (unchanged, not in this PR)
In apps with both island and regular pages,
collectRouteCss(routing-assets.ts) puts a chunk's own CSS before the CSS of chunks it imports, so the islands stylesheet can come before shared layout CSS. That order already applied to direct page CSS onmain. Changing it would change the link order on every page.Tests
New production-build tests for each adapter (
packages/{react,vue,svelte,solid}/test/integration/island-css-build.test.ts, sharedtest/island-css-build.ts). Each one builds a static app where a layout renders a component that imports CSS, with an island page and a Markdown page, and checks:<style>, Vue scoped with matchingdata-v-*, Svelte matchingsvelte-*class) appears exactly once;<script>;hydrateRoot, anddist/ssrhas no islands client.Plus unit tests for
collectIslandStylesandislandStyleRoots(order, no repeats,\0ids,?inline/?url).mainsourcesvp fmt --check,vp lint, typecheck void/react/vue/svelte/solid🤖 Generated with Claude Code