Closed richtong closed 8 years ago
I've never used this with docker (or the --inline
option) but I think you can use the hostname
option listed here https://github.com/HenrikJoreteg/hjs-webpack/blob/master/README.md#devserver-optional-object to do the same thing as --host
.
Yup I'm trying it now. There doesn't to be an equivalent of --inline though so it I'm not clear on what URL to use. That is with the regular webpack-dev-server, you have to access this via http://localhost:3000/webpack-dev-server/index.html as you are running in iframe mode. I'm running it now.
This whole thing is a little confusing so thanks much for your answers.
OK the latest version 8 does not seem to work with that being set. Also I tried to side install webpack-dev-server and use those inline commands and this didn't work either. The server is not accepting requests "off machine", so now I'm trying an older version. I used the tutorial on his in https://github.com/bclinkinbeard/egghead-hjs-webpack-demo and I did get this to work
OK, reverting to the 2.12 version seems to work properly, something is broken with the very different hjs-dev-server compared with the generic webpack-dev-server, so if you want to use docker with his-webpack, you should stay on the 2.12 version
What version are you referring to? hjs-webpack
? node
? docker
?
I hit this bump too and found the workaround in https://github.com/webpack/webpack-dev-server/issues/183 before I saw this issue.
Works for me with just config.devServer.hostname = '0.0.0.0';
in my webpack config. I didn't limit my npm installs to specific versions.
Thanks for the workaround @asyazwan! That sounds like the right fix, and I think the version was referring to the hjs-webpack
version. So it's good to hear that you got it working without reverting to an old hjs-webpack
. I'm gonna close this now, as this seems like the best workaround.
I have been able to get the regular webpack-dev-server running with --host 0.0.0.0 --inline options, but these do not appear to be available with the his-dev-server, how do you configure these options.
In looking at this, it looks like it is also possible to use the webpack-dev-server as well, but I'm not clear how to do this. Any guidance would be great as I'm new to the react world.
We use docker containers for our work and without those two options, the development mode is not available outside of the docker container.
If also looks like the tutorial you did is for version 2 and not your current version, so it is out of date. The older 0.2 looks like it just uses the standard webpack-dev-server but you now use your own. I think you need to do an
npm --save-dev hjs-webpack
and then in webpack.config.js you need to add a tagdevServer : { hostname : "0.0.0.0" }
Also it is unclear how to just make the standard webpack-dev-server work. Is it as simple as adding
npm --save-dev webpack-dev-server
as I do not see where you really rely on his-dev-server.The final question is about the README.md, should you install this as
npm --save-dev hjs-webpack
since you do not want this in your production installation?