devkit icon indicating copy to clipboard operation
devkit copied to clipboard

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

Open 56789a1987 opened this issue 1 year ago • 2 comments

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?

56789a1987 avatar May 26 '24 09:05 56789a1987

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! 😊

yjaaidi avatar May 28 '24 13:05 yjaaidi

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?

56789a1987 avatar May 31 '24 18:05 56789a1987