-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
The css file is not generated into the corresponding directory #12072
Comments
I encountered this bug as well. Looks like it was introduced by @patak-dev in this commit. It also seems to be a deliberate decision, as the change is prepended with the following comment:
I wasn't able to find any clarifications on why it's the case and would be really interested to hear the rationale for it. And I'm not the only one who has problems with that decision as this comment and this discussion suggest. Anyway, my use-case is to use Vite to build a library that has multiple self-contained directories in the output (basically what this discussion suggests). For me not being able to access the directory structure in |
And to sit into one common directory Also this issue is related to: #11424 |
I want to modularize and provide minimal imports. No path is given, so it is impossible to distinguish who is who, and it is also impossible to split the css into corresponding modules |
Our use case also relied on I too would be interested in learning how to deal with use cases like this where |
I ran into this too and I'm voicing my wish that preserving the directory structure of assets will be supported. 🙏 For my use case, I was able to work around it with a simple plugin. I tried adapting it to the reproduction in the OP and I think it allows for the desired result. Here’s the fork in case it helps anyone. |
Also encountering this issue. I want to preserve the directory structure since I'll still be manually referencing scripts and stylesheets in my .cshtml files in ASP.NET. I have an implementation using Would REALLY love a fix for this. The option to preserving the directory structure for all the files seems to me like a very important feature to have. |
I ran into this issue as well. I would like |
Tried to update to vite 4 and ran into this. |
To add a slightly different use case: CSS assets seem to take their names from the basenames of modules that import them, which tends to be problematic when working with the following component/page directory structure, as you might with (say) (p)react:
Because of this (and route-based code splitting), I have 26 While the previous suggestion of exposing the source file path would be great, I'd also be very happy with a simple |
This also bit me 🙁 doing a multi-page app and need to be able to get the known path names. |
Any moves forwards? Because its annoying, this feature is removed on v4 |
Still no progress? I installed the latest vite and the results are the same as before...sad... |
@supuwoerc it's done, but they want to add it to 5.18 it's in beta right now, i'm also waiting, it's sad they don't publish it for v4 |
Thanks for informing, looking forward to release soon ~ |
Describe the bug
vite": "4.1.1"
When both cssCodeSplit: true and rollupOptions.output.preserveModules: true are set to true, the css file is not generated into the corresponding directory, and the file path is deleted in the code
It is recommended to keep the file path
Reproduction
https://stackblitz.com/edit/vitejs-vite-g83ntf?file=src%2Fdom1%2Findex.ts,src%2Fdom2%2Findex.ts,src%2Findex.ts,vite.config.ts&terminal=dev
Steps to reproduce
npm run build
System Info
Used Package Manager
npm
Logs
❯ npm run build
$ vite build
vite v4.1.1 building for production...
✓ 5 modules transformed.
dist/es/index2.css 0.02 kB │ gzip: 0.04 kB
dist/es/index.css 0.02 kB │ gzip: 0.04 kB
dist/es/dom1/index.js 0.09 kB │ gzip: 0.09 kB
dist/es/dom2/index.js 0.09 kB │ gzip: 0.09 kB
dist/es/index.js 0.17 kB │ gzip: 0.13 kB
Validations
The text was updated successfully, but these errors were encountered: