I'm using the react-datepicker npm module and its styles got broke (styles are not being applied) when I deploy the build, it's working fine in the local environment.
I've imported its styles like this: import 'react-datepicker/dist/react-datepicker.css';
I found somewhere to import like this: import './../../node_modules/react-datepicker/dist/react-datepicker.css';
It's also not working.
I thought this could be the reason because of SSR so I removed SSR for this component but had no luck with CSR as well.
Current Result
Desired Result
Here is my Component code:
import React from 'react';
import DatePicker from 'react-datepicker';
import calendarIcon from './../../assets/images/calendar-icon.svg';
import 'react-datepicker/dist/react-datepicker.css';
// import 'react-datepicker/dist/react-datepicker-cssmodules.min.css';
import './Datepicker.scss';
const Datepicker = ({ datepickerClassName, datepickerStyle,
selectedDate, datepickerInputClassName, handleChange }) => (
<div className={`datepicker d-flex align-center
${!!datepickerClassName ? datepickerClassName : ''}`}
style= {datepickerStyle}
>
<span className='d-flex align-center icon-container'>
<img src={calendarIcon} className='icon' />
</span>
<DatePicker
placeholderText='DD/MM/YYYY'
dateFormat='dd/MM/yyyy'
id='start-date'
autoComplete='off'
selected={selectedDate}
className={datepickerInputClassName}
onChange={handleChange}
/>
</div>
);
export default Datepicker;
Please help me with this if someone faced this issue or has some idea about this.