Webpack Hot Module Replacement: Cannot find update

时间:2017-08-04 12:27:06

标签: javascript webpack webpack-dev-server webpack-2 webpack-hmr

I've set up a Webpack project with 2 entries. I can connect to the dev server and there are no error messages. Though, when I change one of the entry files, Webpack recompiles (without any errors), the client notices and tries to fetch a JSON, wich doesn't exist. Here is the full log after connecting to the dev server:

  [HMR] Waiting for update signal from WDS...
  main.js:20 [WDS] Hot Module Replacement enabled.
2 main.js:20 [WDS] App updated. Recompiling...
  main.js:20 [WDS] App hot update...
  main.js:20 [HMR] Checking for updates on the server...
  main.js:1 GET http://localhost:8080/68003e2dfaa592e9b4dc.hot-update.json 404 (Not Found)
  main.js:20 [HMR] Cannot find update. Need to do a full reload!
  main.js:20 [HMR] (Probably because of restarting the webpack-dev-server)

I didn't restart the dev server...

Here's my config:

const path = require("path")
const webpack = require("webpack")

var buildEntryPoint = function(entryPoint){
  return [
    entryPoint,
    'webpack/hot/only-dev-server',
    'webpack-dev-server/client?http://localhost:8080'
  ]
}

module.exports = {
    entry: {
        main: buildEntryPoint("./src/main.js"),
        channel: buildEntryPoint("./src/channel.js")
    },
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "[name].js"
    },
    module: {
        loaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'react-hot-loader!babel-loader'
        }]
    },
    resolve: {
        extensions: ['*', '.js', '.jsx']
    },
    devServer: {
        contentBase: path.join(__dirname),
        hot: true,
        inline: true,
        port: 8080
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ]
}

I've tried searching in the different folders of my project to see if the file was there, but with no luck. Webpack is at version 2.7.0 and the dev server at 2.6.1.

Where's the issue here, why does it request a file that doesn't exist?

0 个答案:

没有答案