-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic css import not working #16735
Comments
Start a new pull request in StackBlitz Codeflow. |
I also have an issue with the import-analysis. [vite] warning: This import should be legit while starting with "./" I do not think there is much I can do here while that code is automatically generated. I was on vite 5.1.4 and now tried to update it to 5.2.11 with the same result. |
ignoring it is not a resolution, I need to bundle them correctly and chunk for each css should be created |
I updated the issue to clarify expectations |
might be related #14102 |
ooo please.... seems its only works this way https://github.com/spamshaker/vite-css-bundling-issue/blob/working/src/theme-loader.ts Now those two chunks have been created and finally can be reached in runtime: dist/assets/theme-dark-6jg3YJQ8.css 0.03 kB │ gzip: 0.04 kB full output I got:
|
Does anyone know if this is gonna be like that or it it's going to be fixed? |
here is exactly what I needed and it seems to be working this means that it loads it in appropriate way - switch/case is enough in my case. I have put it into node_modules to ensure that it can be bundled when the css is provided as a library as for the At this stage if no objection the Issue could be closed, or the documentation would need to be updated as I saw there are opened couple of similar issues like |
I'm having a similar issue (I think) with Vue single file components dynamically loaded via Vite In production, dynamically loaded components are missing a lot of CSS styles. There is no issue when running vite in dev mode. As suggested in #10630, this seems to be triggered by the |
Vite does not support CSS import attributes yet (#17700). |
Describe the bug
Here is a reproduced issue. I am trying to load css dynamiclally
https://github.com/spamshaker/vite-css-bundling-issue
this says that it should work
https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#import-assertions
I am getting
Reproduction
https://github.com/spamshaker/vite-css-bundling-issue
Steps to reproduce
npm i && npm run build && npm run preview
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: