Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HMR] Update failed: Error: Manifest request to /static/[hash].hot-update.json timed out. #120

Open
mainrs opened this issue Mar 3, 2017 · 4 comments

Comments

@mainrs
Copy link

mainrs commented Mar 3, 2017

I am basically trying to get react-hot-loader working within Electron. Each time I edit the app.jsx file I get the following error:
GET file:///D:/static/adf5c4b76bacb23d7c36.hot-update.json net::ERR_FILE_NOT_FOUND
Looks like it tries to load the file from my hard drive instead of loading it from the dev server. The error is followed by this message:

[HMR] Update failed: Error: Manifest request to /static/adf5c4b76bacb23d7c36.hot-update.json timed out.
   at XMLHttpRequest.request.onreadystatechange (http://localhost:3000/static/bundle.js:38:22)

Here is my webpack 2 config file

const path = require('path');
const webpack = require('webpack');

module.exports = {
  entry: [
    'react-hot-loader/patch',
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    './src/index.jsx'
  ],

  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'app'),
    publicPath: '/static/',
  },

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

  devtool: 'inline-source-map',

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: ['babel-loader'],
        exclude: /node_modules/,
      },
    ],
  },

  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('development'),
    }),
  ],

  // dev server properties
  devServer: {
    hot: true,

    host: 'localhost',
    port: 3000,
  }
};

index.jsx

import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import App from './js/components/app';

// the element used to inject react at runtime
const element = document.getElementById('root');
// a simple replacer function used to inject components at runtime
const render = Component => {
  ReactDOM.render(
    <AppContainer>
      <Component/>
    </AppContainer>,
    element
  );
};

// first application render call
render(App);

// hot module reload logic
if(module.hot) {
  module.hot.accept('./js/components/app', () => {
    render(App);
  });
}

I am really new to the whole JS environment and seeing all my attemps fail is quite frustrating :( Any help is appreciated.

@kimjuny
Copy link

kimjuny commented Jun 26, 2017

Did you fix this problem? @sirwindfield

@mainrs
Copy link
Author

mainrs commented Jun 26, 2017

Nop

@S0urceC0der
Copy link

the publicPath shuld be http://localhost:3000/static/

The same problem can be found here:
https://stackoverflow.com/questions/43503748/electron-webpack-hmr-neterr-file-not-found

@livelifelively
Copy link

Faced the same issue today. Issue seems to do with websockets and their availability. After restarting the system, it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants