Skip to content

fix: keep zero-runtime stylesheet modules out of client treeshaking - #305

Merged
DylanPiercey merged 2 commits into
mainfrom
dpiercey-ws-vanilla-extract-test-2rvyxh
Aug 15, 2026
Merged

fix: keep zero-runtime stylesheet modules out of client treeshaking#305
DylanPiercey merged 2 commits into
mainfrom
dpiercey-ws-vanilla-extract-test-2rvyxh

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

The client build defaults every module to side-effect free, keeping only .marko files, styles, assets, and bare-import subgraphs. A zero-runtime stylesheet module (*.css.ts / *.css.js, as used by vanilla-extract) looks pure — it only exports class name strings — so when nothing in the client bundle references those exports, the module is dropped and its stylesheet is silently never emitted. The page renders unstyled with no build warning.

This treats those modules as side-effectful by path, alongside styles and assets.

@changeset-bot

changeset-bot Bot commented Aug 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ced6867

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/vite Patch

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

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82923498-014f-4a56-9c0f-293e8dd23461

📥 Commits

Reviewing files that changed from the base of the PR and between a435f52 and ced6867.

📒 Files selected for processing (1)
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts

Walkthrough

The change classifies .css.js and .css.ts stylesheet modules as side-effectful in isSideEffectFile. The browser-side-effects fixture adds a server-only stylesheet-module import and records client-side loading. A patch changeset documents the behavior.

Merge Risk: ⚪ Minimal · up to ced68

This localized change keeps stylesheet modules from being removed during client tree-shaking; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preventing zero-runtime stylesheet modules from client tree-shaking.
Description check ✅ Passed The description directly explains the tree-shaking issue and the fix for zero-runtime stylesheet modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dpiercey-ws-vanilla-extract-test-2rvyxh

Comment @coderabbitai help to get the list of available commands.

@DylanPiercey
DylanPiercey merged commit 9d85c29 into main Aug 15, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant