css-modules / css-modules-require-hook

A require hook to compile CSS Modules in runtime
MIT License
484 stars 44 forks source link

Warnings "require.extensions is not supported by webpack. Use a loader instead." and errors "Module not found: Error: Cannot resolve module 'fs'" #67

Closed wzup closed 8 years ago

wzup commented 8 years ago

Doesn't work. Errors. What is this and how to solve?

    WARNING in ./~/css-modules-require-hook/lib/index.js
    Critical dependencies:
    79:40-60 the request of a dependency is an expression
     @ ./~/css-modules-require-hook/lib/index.js 79:40-60

    WARNING in ./~/css-modules-require-hook/lib/attachHook.js
    require.extensions is not supported by webpack. Use a loader instead.

    WARNING in ./~/css-modules-require-hook/lib/attachHook.js
    require.extensions is not supported by webpack. Use a loader instead.

    ERROR in ./~/css-modules-require-hook/lib/index.js
    Module not found: Error: Cannot resolve module 'fs' in c:\Users\user\demo-app\node_modules\css-modules-require-hook\lib
    resolve module fs in c:\Users\user\demo-app\node_modules\css-modules-require-hook\lib
      looking for modules in c:\Users\user\demo-app\node_modules
        c:\Users\user\demo-app\node_modules\fs doesn't exist (module as directory)
        resolve 'file' fs in c:\Users\user\demo-app\node_modules
          resolve file
            c:\Users\user\demo-app\node_modules\fs.js doesn't exist
            c:\Users\user\demo-app\node_modules\fs doesn't exist
            c:\Users\user\demo-app\node_modules\fs.jsx doesn't exist
            c:\Users\user\demo-app\node_modules\fs.react doesn't exist
            c:\Users\user\demo-app\node_modules\fs.scss doesn't exist
            c:\Users\user\demo-app\node_modules\fs.json doesn't exist
            c:\Users\user\demo-app\node_modules\fs.jpeg doesn't exist
            c:\Users\user\demo-app\node_modules\fs.jpg doesn't exist
            c:\Users\user\demo-app\node_modules\fs.png doesn't exist
            c:\Users\user\demo-app\node_modules\fs.gif doesn't exist
            c:\Users\user\demo-app\node_modules\fs.svg doesn't exist
mightyaleksey commented 8 years ago

what do you do?

mightyaleksey commented 8 years ago

Looks like you included a file with css-modules-require-hook module and webpack fails to load Node.js core modules. There are few ways to solve it: