Skip to content

Cannot find module "!!./../node_modules/css-loader/ ... #240

@xzilja

Description

@xzilja

I ran into this issue today and spent a lot of time figuring out why it is not working, but here is the error I get in inspector tools that I believe is related to css-loader:

Uncaught Error: Cannot find module "!!./../node_modules/css-loader/index.js!./../node_modules/sass-loader/index.js!./main.scss"

and this one in console:

ERROR in ./~/css-loader!./~/sass-loader?sourceMap!./style/main.scss Module build failed: @import './components/Story/story-editor'; ^ File to import not found or unreadable: ./components/Story/story-editor Parent style sheet: stdin in /home/rof/src/github.com/TeamDojo/DojoAdmin/style/main.scss (line 94, column 1) @ ./style/main.scss 4:14-125

This is how I use css loader inside my webpack:

var path = require('path');
var webpack = require('webpack');
var node_modules_dir = path.resolve(__dirname, 'node_modules');

module.exports = {
  entry: [
    'webpack/hot/dev-server',
    'webpack-dev-server/client?http://localhost:8081',
    path.resolve(__dirname, 'src/index.js')
  ],
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: 'bundle.js'
  },
  module: {
    loaders: [{
      test: /\.(js|jsx)$/,
      exclude: [node_modules_dir],
      loader: 'babel'
    },
    {
      test: /\.scss$/,
      exclude: [node_modules_dir],
      loader: 'style!css!sass'
    }]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"development"'
    })
  ]
};

My project structure

...
src/
  index.js
style/
  main.scss

And I'm including my main.css file like this inside index.js

import '../style/main.scss';

node v: 5.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions