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

Hot module / hrm not working anymore? #862

Closed
damianobarbati opened this issue Mar 29, 2017 · 5 comments
Closed

Hot module / hrm not working anymore? #862

damianobarbati opened this issue Mar 29, 2017 · 5 comments
Labels

Comments

@damianobarbati
Copy link

damianobarbati commented Mar 29, 2017

Config example:

//webpack config
devServer: {
	port: 9000,
	historyApiFallback: {
		rewrites: [
			{ from: /superadmin*/, to: '/build/superadmin/index.html' },
			{ from: /admin*/, to: '/build/admin/index.html' },
			{ from: /user*/, to: '/build/user/index.html' },
			{ from: /.+?/, to: '/build/visitor/index.html' },
		],
	},
	proxy: {
		'/api': 'http://localhost:8080',
		'/p/api': 'http://localhost:8080',
	},
	compress: true,
	hot: true,
	hotOnly: true,
},
entry: {
	'visitor/app': ['./public/visitor/entrypoint.js'],
	'user/app': ['./public/user/entrypoint.js'],
	'admin/app': ['./public/admin/entrypoint.js'],
	'superadmin/app': ['./public/superadmin/entrypoint.js'],
	'vendor': [
		'react-hot-loader/patch',
		'webpack-dev-server/client?http://0.0.0.0:9000',
		'babel-polyfill',
		'autobind-decorator', 'axios', 'lodash', 'material-ui', 'moment', 'moment-timezone',
		'react', 'react-dom', 'react-tap-event-plugin', 'react-redux', 'react-router', 'redux', 'reflexbox',
	],
},
output: {
	filename: 'build/[name].min.js',
	publicPath: '/',
},

//visitor/entrypoint.js

document.write('visitor');
console.log('visitor');

http://localhost:9000/ shows correctly the visitor bundle/app.
I try to change the word "visitor" with "whatever" but nothing happens, HMR seems to connect correctly but then once the bundle gets updated nothing is changed on browsers.
Here the console: what's wrong?

screen shot 2017-03-29 at 16 31 05

@rvanmil
Copy link

rvanmil commented Apr 12, 2017

Same issue here, everything seems to be working correctly, but the DOM is not updating.

hmr log

@rvanmil
Copy link

rvanmil commented Apr 12, 2017

I found a solution over here. gaearon/react-hot-loader#511 (comment)

@davecranwell
Copy link

davecranwell commented Apr 13, 2017

I've been experiencing this too, and discovered that adding --hot flag to webpack-dev-server works. I'm not clear if it's quite the same kind of refresh that HMR might do though.

The if(module.hot) solution is a workaround at best.

@shellscape
Copy link
Contributor

Pruning due to age and apparently solution/workaround.

@PixsaOJ
Copy link

PixsaOJ commented May 28, 2018

sorry, I am noob here.

I found a solution over here. gaearon/react-hot-loader#511 (comment)

What is that App in:
const NextApp = require('components/App').default; ?

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

No branches or pull requests

5 participants