-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Description
Hi, I've been struggling with an issue that causes our override CSS rules to fail on some builds. In our production app it is actually inconsistent - however the simple local reproduction repository i've linked to seems to reproduce consistently.
When using a single entrypoint the generated index.html correctly outputs vendor.css followed by the local css (index.css). However when i include a second entrypoint with exactly the same content as the first entrypoint the generated index.html files have the CSS defined in the wrong order in all entrypoints. The CSS is ordered correctly in Vite serve mode.
Using main.js
import { VApp } from "vuetify/lib";
console.log(VApp);
import '../style.css'
document.querySelector('#app').innerHTML = `
<div class="v-application theme--light">I should have a blue background as my CSS is overridden in style.css</v-application>
`
With one entrypoint in correctly outputs:
...
<link rel="stylesheet" href="/assets/vendor.06e82a89.css">
<link rel="stylesheet" href="/assets/main.b16cdc1a.css">
...
But including a second entrypoint with the same js content flips the CSS ordering in both the output html files:
build/index.html
...
<link rel="stylesheet" href="/assets/style.0cc4c6eb.css">
<link rel="stylesheet" href="/assets/vendor.06e82a89.css">
...
build/entrypoint2/index.html
...
<link rel="stylesheet" href="/assets/style.0cc4c6eb.css">
<link rel="stylesheet" href="/assets/vendor.06e82a89.css">
...
Reproduction
https://github.com/fango256/vite-css-ordering-issue
System Info
System:
OS: Windows 10 10.0.22000
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 40.92 GB / 63.92 GB
Binaries:
Node: 16.5.0 - C:\Program Files\nodejs\node.EXE
npm: 7.19.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (93.0.961.38)
Internet Explorer: 11.0.22000.120
npmPackages:
vite: ^2.5.4 => 2.5.6
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.