webpack-contrib / webpack-hot-middleware

Webpack hot reloading you can attach to your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hot-update.json 404

Richard-Choooou opened this issue · comments

Why does the hash are different? the hash of the hot-update files used the previous compiler's hash value.

image

image

The hot update mechanism is part of webpack core - this module is just a communication channel.

And this is my webpack config

// const baseConfig = require('./webpack.common')
const clientBaseConfig = require('./webpack.client.base')
const serverBaseConfig = require('./webpack.server.base')
const webpack = require('webpack')
const merge = require('webpack-merge')
const path = require('path')

module.exports = [merge(clientBaseConfig, {
    entry: {
        client: [path.resolve(__dirname, '../app/client/client.entry.tsx'), 'webpack-hot-middleware/client?name=client']
    },
    devtool: "inline-source-map",
    output: {
        publicPath: '/',
        filename: '[name].index.[hash].js',
        path: path.resolve(__dirname, '../app/server/static/dist'),
        hotUpdateChunkFilename: 'hot/[hash].hot-update.js',
        hotUpdateMainFilename: 'hot/[hash].hot-update.json'
    },
    mode: "development",
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ]
}), merge(serverBaseConfig, {
    target: 'node',
    entry: {
        server: [path.resolve(__dirname, '../app/client/server.entry.tsx')]
    },
    devtool: "inline-source-map",
    output: {
        publicPath: './',
        filename: '[name].index.js',
        path: path.resolve(__dirname, '../app/dist'),
        libraryTarget: 'commonjs2'
    },
    mode: "development"
})]

@glenjamin But how can I fix 404 error, can you give me an advance?

The file does not exist, not path mistake

Webpack itself is responsible for generating those files and making the client request the right ones.

The problem here is likely to be related to the config that is overriding the hot update paths.

You’ll need to open a support ticket on whatever system webpack recommends for help with project config. You’ll likely need to also include the code which sets up the middleware

This is my middleware setting

const webpack = require('webpack')
const webpackDevConfig = require('../../build/webpack.dev.js')
const compiler = webpack(webpackDevConfig)
const webpackMiddleWare = require('webpack-dev-middleware')

app.use(webpackMiddleWare(compiler, { serverSideRender: true, publicPath: webpackDevConfig[0].output.publicPath }));
app.use(require("webpack-hot-middleware")(compiler));

@Richard-Choooou
Did you find solution for this problem ?

@Richard-Choooou My webpack.config.js is very similar than yours, and i'm facing the same bad experience, did you solve this? Could you explain more about your experience about this?

Thanks.

I'm facing this issue and my webpack.config.js is similar as well, any news regarding this issue?