webpack and react jsx - hot loading not working wi

2019-06-25 04:24发布

问题:

Changed to: hot loading does not work in docker and it looks like it is a docker issue.

Following this: React with webpack or this React hot loader on local host machine they work fine and to me, they work the same - still I dont get why you would install React hot loader?

But running it in a container, updating/"hot loading" does not work in any of them. So this might be a question a docker expert?

回答1:

As described on GitHub, you can do this:

watchOptions: {
    poll: true
}

Or, in the package.json, instead of --watch do --watch --watch-poll.



回答2:

I found a workaround; I have a reverse proxy(nginx) running in a container. The proxy forwards back to my main host computer(a Mac) on a port. This gives me hot loading and most important, I have no issues with cross domain as I have my database running in yet another container.



回答3:

If you are just looking for a proper file watching solution on a mac with Docker, check out docker-osx-dev. It uses boot2docker behind the scenes, but adds rsync support. I tried it and it works great for file changes.