DEV Community

Discussion on: Develop a Full-Fledged Component Library with React, just like Material UI

Collapse
 
funnypan profile image
panfan

how to solve images & svgs used by each components?

I have tried some methods.but nothing done.

Collapse
 
irzhywau profile image
Irzhy Ranaivoarivony • Edited

there is dedicated plugin on rollup for svg ang other images, you probably need to check @rollup/plugin-image and rollup-plugin-svg-import packages.
Though there is a caveat, especially for images, they will be converted into base64 so your library will be larger

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

Typically you shouldn't use rastor images in a ui library. To use vector images like svgs, create components for them (since svg elements are valid html & jsx elements)