css-loader not importing .css file returning empty object

╄→гoц情女王★ 提交于 2019-12-05 05:12:27

I wonder if this is perhaps you are not using css-modules. The example you are showing there is an example of implementing the css-modules feature of the loader.

Perhaps try adding the ?modules query to your css-loader definition.

You can fix your problem with three ways :

1:

Replace 'css-loader' with 'css-loader?modules=true&camelCase=true'

2:

Do old school like this :

index.js

import React from 'react'   
import './header.css'

export default class Header extends React.PureComponent {
  render() {
    return(
      <header className = {"header"}>
        This is header component
      </header>
    )
  }
}

3:

use babel-plugin-react-css-modules or React CSS Modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!