Rails Webpacker 3.0 imports CSS file not working

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!

+7
ruby-on-rails webpack webpacker
source share

No one has answered this question yet.

See similar questions:

one
Sass support in Rails 5.2 with webpacker 3+ directly in JS

or similar:

5
What is the difference between using extract-text-webpack-plugin and linking the combined CSS file in the HTML header?
4
How to use @ font-face with webpack css-loader?
one
Webpack 4 basic React js hello world fails with "Parsing Error: Unexpected Token"
one
Do I need to import a sheet CSS file?
0
Rails Webpacker internal assets do not extend to action_controller.asset_host
0
reaction-universal component with webpack-flush-chunks: css bootstrap
0
Webpack React externals not working
0
error with web package - you may need an appropriate loader to handle this type of file
0
Problem with Webpack css, missing bundle.css
0
How to fix HTML comments of files that are not ignored by Webpack Dev Server?

All Articles