Webpack hmr net::ERR_INCOMPLETE_CHUNKED_ENCODING
Asked Answered
L

3

6

When it loads everything is ok and hmr is working. Then this error is appearing.

GET http://localhost:3000/__webpack_hmr net::ERR_INCOMPLETE_CHUNKED_ENCODING

It's like the webpackdevserver is kinda crashing then relaunch, it takes few seconds then the hmr is working again

[HMR] connected

an then 'crash' and so on ...

It seems I have this issue only in Chrome (version 55) (tested with mozilla and this problem doesn't appear).

I may have missed something in my webpack or node conf but can't find something in the doc.

Any idea how to fix this ?

//BELOW THE webpack conf

const path = require('path');
const merge = require('webpack-merge');
const TARGET = process.env.NODE_ENV;
process.env.BABEL_ENV = TARGET;
const webpack = require('webpack');
const NpmInstallPlugin = require('npm-install-webpack-plugin');

const PATHS =  {
    app: path.join(__dirname, 'client'),
    build: path.join(__dirname, 'build')
};

const common = {
    entry: {
        app: [PATHS.app, 'webpack-hot-middleware/client']
    },

    resolve: {
        extensions: ['', '.js', '.jsx']
    },

    output: {
        path: PATHS.build,
        filename: 'bundle.js',
        publicPath: '/'
    },
    module: {
        loaders: [
            {
                test: /\.css$/,
                loaders: ['style', 'css'],
                include: PATHS.app
            },
            { 
                test: /\.jsx?$/,
                loaders:['babel?cacheDirectory=true'],
                include: PATHS.app
            }
        ]   
    }
};

if(TARGET === 'dev' || ! TARGET) {
    module.exports = merge(common, {
        // devServer: {
        //  contentBase: PATHS.build,
        //  historyApiFallback: true,
        //  hot: true,
        //  inline: true,
        //  progress: true,
        //  stats: 'error-only',
        //  host: 'http://127.0.0.1/',
        //  port: 3000
        // },
        export: {
            isDev: true
        },
        plugins: [
            new webpack.optimize.OccurrenceOrderPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.DefinePlugin({
              'process.env.NODE_ENV': JSON.stringify('dev')
            }),
            new NpmInstallPlugin({
                save: true
            })
        ],
        devtool: 'eval-source-map'
    });
}

if(TARGET === "build") {
    module.exports = merge(common, {});
}

// Nodejs route

this.app.get('/', function(req,res) {
            res.sendFile(path.join(__dirname, './../../build/index.html'))
        })

// index.html

<!DOCTYPE html>
<html>
    <head>
        <title> Ripple Data Analyzer</title>
    </head>
    <body>
        <div id='root'>
        </div>
        <script src="bundle.js"></script>
    </body>
</html>

//index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App.jsx';

ReactDOM.render(<App/>, document.getElementById('root'));
Lavena answered 10/1, 2017 at 22:47 Comment(1)
I am seeing this issue too, but I don't have an explicit server timeout. That said, it only crashes once, and then reconnects.Schaffel
L
2

the real reason was that I put a setTimeout on my node server

server.timeout = 100;
Lavena answered 30/1, 2017 at 20:6 Comment(0)
S
1

I suggest you to update node.js to latest LTS version, because this is node bug that was fixed in version 8.1.0 (not sure about version)

sudo s 8.9.1 (for linux)

Summerlin answered 3/12, 2017 at 0:49 Comment(0)
F
1

Guy, I suggest you update your node version, this is a problem with node link , but to solve your problem easily, follow this steps: node -v sudo npm cache clean -f sudo npm i n -g sudo n stable node -v See you ;)

Fording answered 19/12, 2017 at 0:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.