Closed glenjamin closed 9 years ago
@glenjamin What if we changed the recommendation to webpack-dev-server inline
? That way we wouldn't need an entry at all given it injects one automatically. As a bonus tweaking the ip and port becomes easier.
That would work too, the downside being that it's not quite as clear what is going on if you want to tweak the config.
Ok, I'll change it to what you proposed and link to an alternative resource for inline
based setup with a bit different ideas.
I've got error by changing to config of @glenjamin:
What I did:
<script src="http://localhost:8080/webpack-dev-server.js"></script>
in my index.htmlI've got a blank page and error on console: [HMR] Waiting for update signal from WDS... TypeError: undefined is not an object (evaluating 'global.WebSocket')
I try to comment // 'webpack-dev-server/client?http://localhost:8080', first page is ok, but I didn't get Automatic browser refresh. Did I miss some thing?
Any idea @glenjamin? Do you have working configuration to compare against?
I'll try and dig one out - I haven't used this for a while as I've moved to using my webpack-dev-middleware
instead.
Looks like the approach I describe is the same one react-hot-boilerplate
currently uses.
I had the some error @idisblueflash and I fix it changing npm script from:
"dev": "webpack-dev-server --devtool eval --progress --colors --content-base build"
to:
"dev": "webpack-dev-server --devtool eval --progress --colors --hot --content-base build"
on https://christianalfoni.github.io/react-webpack-cookbook/Automatic-browser-refresh.html
Instead of adding
http://localhost:8080/webpack-dev-server.js
to the HTML, you can addwebpack-dev-server/client?http://localhost:8080
to theentry
list.This also makes it easier to disable HMR changes in production builds.