webpack 配置错误

Hash: 6b1d48e103d0b4a59a7b
Version: webpack 1.13.2
Time: 197ms
chunk {0} bundle.js (main) 3 kB [rendered]

[0] multi main 40 bytes {0} [built] [1 error]
[1] ./~/webpack/hot/only-dev-server.js 2.17 kB {0} [built]
[2] ./~/webpack/hot/log-apply-result.js 788 bytes {0} [built]

ERROR in multi main
Module not found: Error: Cannot resolve module 'webpack-dev-server/client' in /Users/wangchongya/Documents/redux
@ multi main
webpack: bundle is now VALID.

var webpack=require('webpack');
var path=require('path');
var BUILD_PATH = path.resolve(__dirname, './build');
module.exports={

devtool: 'inline-source-map',
entry:[
  'webpack-dev-server/client?http://127.0.0.1:8080/', // WebpackDevServer host and port
  'webpack/hot/only-dev-server',
],
output:{
  path:BUILD_PATH,
  filename: 'bundle.js'
},
resolve: {
  modulesDirection: ['node_modules','src'],
  extensions: ['','.js']
},
module: {
  loaders: [{
    test: /\.jsx?$/,
    exclude: /node_modules/,
    loaders: ['react-hot','babel?presets[]=es2015,presets[]=react']
  }]
},
plugins:[
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
]

};

阅读 7.3k
3 个回答

Module not found: Error: Cannot resolve module 'webpack-dev-server/client'

是不是没装webpack-dev-server?

ERROR in ./entry.js
Module build failed: Error: React Hot Loader: The Webpack loader is now exported separately. If you use Babel, we recommend that you remove "react-hot-loader" from the "loaders" section of your Webpack configuration altogether, and instead add "react-hot-loader/babel" to the "plugins" section of your .babelrc file. If you prefer not to use Babel, replace "react-hot-loader" or "react-hot" with "react-hot-loader/webpack" in the "loaders" section of your Webpack configuration.

我的是这个错误。。为什么。。

entry里面要3个值把,入口文件你光写了两个dev相关的把具体的入口文件也写上啊。。。