找不到模块“./src/index.js”

时间:2016-07-07 07:11:36

标签: node.js reactjs webpack reactjs-flux webpack-dev-server

我是React和Flux的新手,无法弄清楚如何修复下面的错误。加载localhost:8080/app后,控制台显示cannot find module "./src/index.js" (有关错误的截图,请参阅this image。)

有人能告诉我我的代码有什么问题吗?这是我的Webpack配置:

module.exports = {
    entry:[
    "./src/index.js"
    ],
    output: {
        path: __dirname,
        filename: 'app/js/main.js'
    },
    module: {
        loaders: [
        {
            test: /\.jsx?$/,
            loader: 'babel',
            exclude: /node_modules/
        }
        ]
    }
}

这是我的package.json

{
  "name": "react",
  "version": "1.0.0",
  "description": "get and display user github info",
  "main": "react.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "krishna",
  "license": "ISC",
  "devDependencies":{
    "babel-core": "5.8.*",
    "babel-loader": "5.3.*",
    "webpack": "1.12.*",
  },
  "dependencies": {
    "react":"^0.14.7",
    "react-dom":"^0.14.7"
  }
}

0 个答案:

没有答案