I am working on a Rails5 project with Webpacker for React to work properly
But when import my css file inside my root component it seems like it doesn't work at all. Looking at the stylesheet does not come.
This is my root component.
import React from 'react' import ReactDOM from 'react-dom' import StartForm from './insurance_form/start_form' //import PropTypes from 'prop-types' import 'react-datepicker/dist/react-datepicker.css'; // not working ReactDOM.render( <StartForm />, document.getElementById('start-form-index-container') )
This is my webpack/environment.js
const { environment } = require('@rails/webpacker') const merge = require('webpack-merge') const myCssLoaderOptions = { modules: true, sourceMap: true, localIdentName: '[name]__[local]___[hash:base64:5]' } const CSSLoader = environment.loaders.get('style').use.find(el => el.loader === 'css-loader') CSSLoader.options = merge(CSSLoader.options, myCssLoaderOptions) module.exports = environment
So, how can I make imported css work well with webpacker?
Thanks!
ruby-on-rails webpack webpacker
user3403614
source share