eslint-loader webpack es2015解析错误

时间:2015-11-02 17:56:59

标签: webpack babeljs eslint

我的webpack eslint配置:

  eslint: {
    configFile: ".eslintrc",
    emitWarnings: true
  },

  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: "json"
      },
      {
        test: /\.(js|jsx)$/,
        loaders: [
          require.resolve('react-hot-loader'),
          require.resolve('babel-loader'),
          require.resolve('eslint-loader')
        ],
        exclude: /node_modules/
      }
    ]
  },

我的错误:

ERROR in ./src/scripts/main.jsx
Module parse failed: /Users/alexandre/Documents/developpement/piemapping/apple-pie/node_modules/react-hot-loader/index.js!/Users/alexandre/Documents/developpement/piemapping/apple-pie/node_modules/babel-loader/index.js!/Users/alexandre/Documents/developpement/piemapping/apple-pie/node_modules/eslint-loader/index.js!/Users/alexandre/Documents/developpement/piemapping/apple-pie/src/scripts/main.jsx Line 12: Unexpected token
You may need an appropriate loader to handle this file type.
|
| // Imports
| import React from "react";
| import Dispatcher from "./Dispatcher.js";

没有webpack我正在运行这个命令,它运行得很好:

"lint": "eslint . --ext .js --ext .jsx --fix"

我希望webpack在编译时检查我的代码并编译或不依赖eslint是否引发错误。

0 个答案:

没有答案