-
Notifications
You must be signed in to change notification settings - Fork 59
refactor: code cleanup and support for css files in manifest #257
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
base: main
Are you sure you want to change the base?
Conversation
53364af
to
1aecbca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pcfreak30 for your help. I'll look at it in the next days
1aecbca
to
33cf1ee
Compare
Due to further experimenting, I now just have every css asset be added to every export. the metadata is not properly there to track it otherwise. |
Manifest is just preloading, it is just auxiliary, this is why css is not effective
|
Please try to comment this line of code to see if it works properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this PR still valid or is it abandoned?
I can't say. ill be getting back to this likely in my work soon. I am on other priorities atm in my project and will review what @zhangHongEn mentioned So guess hold off on doing anything for now. |
I am working on this again now and checked. no this doesn't help anything. no css files ever run though any of the customResolvers in any of the hooks. Overall there seems to be no good way to link a css import to the module that imported it... so keeping them all in every export seems to be the only path? I haven't found anything obvious yet in the rolldown api for this. |
Ive done more digging and was able to create an experiment that computes the source imports mapped to the js file importing. I can also get the final css asset outputs. However, at-least when running in lib mode, there is no metadata being tracked to link a source css file to the generated css asset that it is in. It appears a PR to vite would be needed to add this to the css plugin in core. So as it stands, tracking every css asset output and putting in every manifest export is the best current solution still :/. |
It seems css files do not get processed at ALL.
So I did a code cleanup and I had it support css files by collecting any found in the graph/tree and any in module ID's. However none may be in the graph, and I found something is manipulating the CSS assets so the filenames change.
In my case I have a generated css asset but a moduleId reference in a js file to
tailwind.css
.Since there is a relational disconnect I did the best thing I could and collected all found css files and added them to any export that was found to have a css file in its moduleId list.
This works well enough for now to ensure its added to the manifest for my purposes.
If anyone knows how to do better, I welcome feedback b/c I couldn't find the data in the vite graph data.