react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Date picker styles not getting applied after built using rollup

Open shettynitin667 opened this issue 2 years ago • 3 comments

I'm working on a component library where I'm using the Date picker component. I have imported CSS (import 'react-datepicker/dist/react-datepicker.css'). When I run storybook in my project, styles are applied, but when I build it using rollup then the styles are not getting applied. My Rollup postcss config looks like this

postcss({
     modules: true,
     extract: true,
     sourceMap: false,
     minimize: true
}),

shettynitin667 avatar Jun 13 '23 11:06 shettynitin667

I'm having the same problem and came looking to see if there was any answers to this problem

kalupa avatar Jul 05 '23 21:07 kalupa

Did you ever figure out a fix for this? I'm having the exact same issue and assumed it was the hashing we were applying to our classes. I excluded classes starting with "react-datepicker" from our storybook/webpack so looks great in storybook. When I add the same to rollup.config, it looks like the datepicker styles aren't even getting compiled as I don't see them in the built page with the hashing or otherwise. I then found a bunch of camel case styles (reactDatepicker__time) but not even sure where these are getting applied. I will try to look more into passing styles through rollup, but wanted to see if you ever found a solution. Thanks!

karenberry13 avatar Oct 18 '23 20:10 karenberry13

This is not a react-datepicker specific issue, but seems to be a rollup plugin setting or issue. Would the following issue be helpful? https://github.com/egoist/rollup-plugin-postcss/issues/298#issuecomment-676210725

( cc @martijnrusschen )

yuki0410-dev avatar Mar 28 '24 12:03 yuki0410-dev