Kevin Powell - CommunityKP-C
Kevin Powell - Communityโ€ข3y agoโ€ข
1 reply
AlT

Vite/Rollup plugin to import CSS into React web component

I also asked on StackOverflow. Please refer to it for more info https://stackoverflow.com/questions/76509761/vite-rollup-plugin-hodtdiw-to-get-styling-css-module-into-a-react-web-component


I am trying to create a Web Component from React. Web Components need you to import styles inside the Shadow DOM raw. Vite will normally inject your CSS into the document body (I think). I'd like to write a Vite plugin to collect all CSS imports from a starting component. It might have sub components that have their own CSS that I'd need to know about as well.

Any help appreciated ๐Ÿ™
Stack Overflow
I am trying to create a Web Component from React. Web Components need you to import styles inside the Shadow DOM. So while my CSS module is imported like this normally
import css from "./MyCom...
Vite/Rollup plugin: How to get styling (CSS module) into a React We...
Was this page helpful?