jscutlery / devkit

Tools that make Angular developer's life easier.
MIT License
232 stars 14 forks source link

[swc-angular-plugin] preserve styles for using this plugin for dev server #410

Open 56789a1987 opened 1 month ago

56789a1987 commented 1 month ago

I have an Angular dev server using swc, this plugin solved the code transformation problem a lot. However this plugin discards all styleUrls and replaces them with empty styles: []. Can we have some options to preserve styles in the result, so we can use it for Angular dev server?

yjaaidi commented 1 month ago

Thanks for raising this issue. This was indeed a shortcut we took as we focused on speeding up "browserless" testing. We should fix this.

All PRs are welcome! 😊

56789a1987 commented 1 month ago

So I tried to add transforming styleUrls, it now works well on the dev server. When running tests in this repo, Vitest is fine, but Jest reports error due to CSS imported as objects.

We need to either make preserving styles optional (enabled or disabled by default), or add a workaround to the existing Jest configs (might make this a breaking change).

Which one is better?