goncalvesjoao / react-to-commonJS

A tool to help you build, test and preview your react component and distribute it as a commonJS module.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to bundle and distribute included third-party CSS with react component?

srinathh opened this issue · comments

I have used CSS modules to import styles from a third-party CSS (material components for web) and have applied it on my React components including the @CSSModules(styles) decorator.

import styles from '@material/card/dist/mdc.card.css'
import CSSModules from 'react-css-modules';

When I try to build it, the built code still seems to refer to the third-party css component rather than a bundled css which causes Module not found: 'postcss' error when trying to import it in an app.

var _materialCardDistMdcCardCss = require('@material/card/dist/mdc.card.css');

Is there a way to bundle all the required css with the component?