Error: Cannot resolve module 'style-loader'

前端 未结 8 1992
情书的邮戳
情书的邮戳 2020-12-24 04:33

I\'m using style-loader with webpack and react framework. When I run webpack in terminal i\'m getting Module not found: Error: Cannot resolve module \'style-loader\'

8条回答
  •  囚心锁ツ
    2020-12-24 05:08

    I wanted to add on to what David Guan said. In the newer versions of Webpack (V2+) moduleDirectories has been replaced with modules. The updated resolve portion of his answer would look like this:

    resolve: {
        extensions: ['.js', '.jsx', '.css'], //An empty string is no longer required.
        modules: [
          'node_modules'
        ]        
    }
    

    For more information you can check out their official documentation. Hope this helps someone out there.

提交回复
热议问题