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\'
I use Windows and did everything but nothing worked. It appeared console didn't have enough permissions. So, after running in Admin mode I re-entered
npm install
and everything worked. You can see the result by appearing a lot of modules in node_modules directory.
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.