Vite: CSS imported from a component can load before the app's base stylesheet
@alexwin0806▲ 0 net votes
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.