Answer the question
In order to leave comments, you need to log in
Django and React Hot Module Reload?
Hai. People, tell me where the jamb? I screwed (it seemed to me) Hot Module Reload but it works somehow 50 to 50. When changes are made to the App.tsx file, the page in the browser is updated, when index.tsx is changed (I change the name value ) it says The following modules couldn't be hot updated: (They would need a full reload!)
import * as React from "react";
export interface AppProps {
name: string;
}
export class App extends React.Component<AppProps, {}> {
render() {
return (
<div>Hello {this.props.name}</div>
)
}
}
[HMR] Waiting for update signal from WDS...
client?4854:22 [WDS] Hot Module Replacement enabled.
client?4854:25 2[WDS] App updated. Recompiling...
client?4854:90 [WDS] App hot update...
only-dev-server.js?2f87:69 [HMR] Checking for updates on the server...
log-apply-result.js?d762:11 [HMR] The following modules couldnt be hot updated: (They would need a full reload!)
log-apply-result.js?d762:13 [HMR] - 76
log-apply-result.js?d762:20 [HMR] Updated modules:
log-apply-result.js?d762:22 [HMR] - 260
only-dev-server.js?2f87:55 [HMR] App is up to date.
import * as React from "react";
import {render} from "react-dom";
import {App} from "./components/App";
render(
<App name='World!'/>, document.getElementById('root')
);
[WDS] App updated. Recompiling...
client?4854:90 [WDS] App hot update...
only-dev-server.js?2f87:69 [HMR] Checking for updates on the server...
log-apply-result.js?d762:11 [HMR] The following modules couldnt be hot updated: (They would need a full reload!)
log-apply-result.js?d762:13 [HMR] - 76
log-apply-result.js?d762:18 [HMR] Nothing hot updated.
only-dev-server.js?2f87:55 [HMR] App is up to date.
import path from "path";
import webpack from "webpack";
export default {
context: __dirname,
devtool: 'eval-source-map',
entry: [
'webpack-dev-server/client?http://127.0.0.1:3000',
'webpack/hot/only-dev-server',
'./client/index'
],
output: {
path: path.resolve('./src/static/js/'),
filename: '[name].js',
publicPath: 'http://127.0.0.1:3000/static/js/'
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
],
module: {
loaders: [
{
test: /\.tsx?$/,
include: path.join(__dirname, 'client'),
loaders: ['react-hot', 'ts-loader']
}
],
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'source-map-loader'
}
]
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components'],
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
}
};
import webpack from "webpack";
import WebpackDevServer from "webpack-dev-server";
import config from "./webpack.config.babel";
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
inline: true,
historyApiFallback: true
}).listen(3000, '0.0.0.0', function (err, result) {
if (err) {
console.log(err)
}
console.log('Listening at 0.0.0.0:3000')
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question