每当我webpack
在终端上运行时,我都会得到:
Hash: efea76b1048c3a97b963
Version: webpack 1.12.13
Time: 33ms
+ 1 hidden modules
ERROR in Cannot find module 'babel-core'
这是我的webpack.config.js文件
module.exports = {
entry: './app-client.js',
output: {
filename: 'public/bundle.js'
},
module: {
loaders: [
{
exclude: /(node_modules|app-server.js)/,
loader: 'babel'
}
]
}
}
package.json
{
"name": "react",
"version": "1.0.0",
"description": "React polling app",
"main": "app-client.js",
"dependencies": {
"babel-loader": "^6.2.2",
"bootstrap": "^3.3.6",
"express": "^4.13.4",
"react": "^0.14.7"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
在安装npm时,您应将babel-loader和babel-core安装为dev-dependency。