-
Notifications
You must be signed in to change notification settings - Fork 869
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels