Css-loader: Unexpected token

Created on 30 Jan 2015  路  7Comments  路  Source: webpack-contrib/css-loader

Hi!
Just getting started with CSS loader. here's my css:

body {
  background: pink;
}

and my js:

var React = require('react');

require('./home.css');

var Home = React.createClass({

    render() {
        return(
            <form className="CreatePlan">
                <h1>Create another plan</h1>
            </form>
        );
    }

});

module.exports = Home;

and my config:

var webpack = require('webpack');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-dev-server/client?http://0.0.0.0:3000',
    'webpack/hot/only-dev-server',
    './scripts/index'
  ],
  output: {
    path: __dirname + '/scripts/',
    filename: 'bundle.js',
    publicPath: '/scripts/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  resolve: {
    extensions: ['', '.js']
  },
  module: {
    loaders: [
      { test: /\.css$/, loader: "style!css" },
      { test: /\.js$/, loaders: ['react-hot', 'jsx?harmony'], exclude: /node_modules/ },
    ]
  }
};

and the error:

/Users/vince/projects/react-hot-boilerplate/node_modules/css-loader/node_modules/source-map/node_modules/amdefine/amdefine.js:274
});
^
SyntaxError: Unexpected token }
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/vince/projects/react-hot-boilerplate/node_modules/css-loader/node_modules/source-map/lib/source-map/source-map-generator.js:8:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

any ideas why?

Most helpful comment

I'm also having this issue, and reinstalling node modules is not working for me. 馃様

All 7 comments

npm exploded. so sorry for the noise.

I have a similar error and I can't figure out why. Could you please explain how you solved it?

rm -rf node_modules && npm install

Best fix :+1:

lol @jhnns i feel like i do it 5 times a day sometimes

I'm also having this issue, and reinstalling node modules is not working for me. 馃様

update node version to latest solve the problem, this error of node v4

Was this page helpful?
0 / 5 - 0 ratings