Skip to content

fix(examples/with-unocss): prevent hydration mismatch by using vite-plugin-solid SSR config - #1982

Closed
KunMoe wants to merge 0 commit into
solidjs:mainfrom
KunMoe:main
Closed

fix(examples/with-unocss): prevent hydration mismatch by using vite-plugin-solid SSR config#1982
KunMoe wants to merge 0 commit into
solidjs:mainfrom
KunMoe:main

Conversation

@KunMoe

@KunMoe KunMoe commented Sep 24, 2025

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

What is the current behavior?

The with-unocss example imports @unocss/reset/tailwind.css directly in app.tsx.
Since SolidStart is SSR-first, this causes hydration mismatches and a visible layout/style shift on load.

What is the new behavior?

Configure UnoCSS via vite-plugin-solid with SSR enabled

  • Enable presetWind4 extension for Tailwind-compatible utilities
  • Removed manual reset import from app.tsx
  • This ensures the generated CSS is consistent between server and client, avoiding hydration mismatches and style shifts.

Main changes

Updated app.config.ts:

import { defineConfig } from "@solidjs/start/config";
import solidPlugin from "vite-plugin-solid";
import UnoCSS from "unocss/vite";
import presetWind4 from "@unocss/preset-wind4";

export default defineConfig({
  vite: {
    plugins: [
      UnoCSS({
        presets: [presetWind4()]
      }),
      solidPlugin({
        ssr: true,
      })
    ]
  }
});

Removed import "@unocss/reset/tailwind.css"; from app.tsx
Verified hydration consistency, no style jumps

Other information

  • Tested locally using pnpm dev in examples/with-unocss
  • No hydration problems
  • No visible layout shift
  • Aligns the UnoCSS integration with UnoCSS Vite SSR best practices

@changeset-bot

changeset-bot Bot commented Sep 24, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fcad0a0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Sep 24, 2025

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit fcad0a0
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/68d4548585a7e60008857499
😎 Deploy Preview https://deploy-preview-1982--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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