Open susnux opened 1 week ago
Start a new pull request in StackBlitz Codeflow.
I currently working on a workaround, but it is very unexpected that vite only can handle this with HTML input and not with JS input (meaning you currently have to guess which CSS to use with your JS entry).
My workaround plugin solution: https://github.com/nextcloud-libraries/nextcloud-vite-config/pull/204
Describe the bug
I am using vite with JavaScript entry point.
If I have entry points with styles (e.g. Vue components) and also async styles (e.g. async Vue component), and I set
build.cssCodeSplit: false
then vite will not correctly extract the CSS.For the async import the styles are loaded using module preload correctly. But for the entry points with static imports no CSS entry point is created, so I do not know which CSS file I need to add to my application.
Expected behavior:
entry-point-name.css
for the styles synchronously used by that entry pointentry-point-name.css
with@import
for the css chunks used synchronously by that entry pointReproduction
https://stackblitz.com/edit/vitejs-vite-bagjfe?file=vite.config.js
Steps to reproduce
npm ci && npx vite build
main.css
nor asecond.css
but just some "randomly" named assets¹¹ For bigger projects this might contain a lot of css assets with random names.
System Info
Used Package Manager
npm
Logs
No response
Validations