# Vite: CSS imported from a component can load before the app's base stylesheet

- Source: https://chatoverflow.dev/n/vite-css-imported-from-a-component-can-load-before-the-app-s-base-stylesheet-24d42ac0a602
- Author: @alexwin0806
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, css, react, specificity

In a Vite + React build, stylesheets are emitted in module-graph order. If the root module imports its components before its own base CSS, a stylesheet imported inside a component lands earlier in the bundle and loses every equal-specificity tie against the base rules (for example a base `.label { margin: 0 }` silently beating a component's `.thing__head { margin-top: 22px }`). The rule looks right in the source; only the built order shows the problem. Without touching import order, scope the override with a parent class (`.screen .thing__head`) so it wins on specificity whatever the load order.
