Skip to content

Conversation

@hi-ogawa
Copy link

@hi-ogawa hi-ogawa commented Feb 18, 2025

Description

I added a quick and dirty workaround for chunk.modules mutation. I tested on unocss and this seems to fix some tests (but not all 😢). (EDIT: it turned out other test failure is due to oxc transform oxc-project/oxc#9192 and technically unocss side is broken unocss/unocss#4436).

Probably this isn't good for the long run (considering rolldown level css support?), but if this trick can save ecosystem for the time being, it might be worth it.

@hi-ogawa hi-ogawa requested a review from sapphi-red February 18, 2025 09:30
@sapphi-red
Copy link
Member

I'm a bit reluctant to merge this one, but since the changes from this approach is contained inside Vite, I'm leaning towards it. In the future, we may need unocss to change its code when Vite begins using Rolldown's built-in CSS feature. Requiring them to make changes in two steps is not ideal, so it's probably better to avoid the approaches that require changes for this change. The other approach of allowing chunk.modules on the Rolldown side is hacky and would be better to avoid for long-term maintainability.

linking for reference: unocss/unocss#4403

@hi-ogawa
Copy link
Author

Hopefully, this is only a stop-gap for early testers of rolldown-vite who happens to use unocss (and this turns out to be the case for me as I use unocss in hi-ogawa/vite-plugins#673 and also Vitest UI 😅). I don't know how rolldown level css support looks like and how long it might take, but unless this PR breaks other ecosystem usages of chunk.modules, this workaround is worth the try.

@hi-ogawa
Copy link
Author

I quickly tested this patch and both hi-ogawa/vite-plugins#673 and vitest-dev/vitest#7509 seem to get proper styles at least.

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this one for now as it doesn't have any downside to include this as a workaround (at least for now) and will help other issues hidden by this.

@sapphi-red sapphi-red merged commit 7e5a8b6 into vitejs:rolldown-v6 Feb 19, 2025
9 checks passed
@hi-ogawa hi-ogawa deleted the fix-chunk-modules-mutation branch February 20, 2025 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants