-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Configuration for webpack dev-server in vm/docker for rebound host interfaces #9343
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
Conversation
|
@Lyrkan could you please review if the proposed changes here are correct according to the latest Encore versions? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... even though it probably still works I think it would be better to use the --public option that was recently fixed by @lyrixx in symfony/webpack-encore#529.
Main reasons:
- You don't have to add an additional check to your
webpack.config.jsfile (and if you do it'd be better to useif (Encore.isDevServer())) - It keeps all the "dev-server"-related options in the command line (with
--hostand--disable-host-check) - You won't get the warning that is triggered by calling
setPublicPathwith an absolute URL
|
sorry guys, I did read your comment, but my brain did not convert that into an actual action :) I replaced the config option with using --public. I tested this right now and works, too. It's much cleaner like this. |
… to all interfaces
|
@Kocal could you please review this proposed change? (Don't worry about grammar issues or syntax issues because we can fix those while merging). Thanks! |
|
There is already https://symfony.com/doc/current/frontend/encore/virtual-machine.html that covers webpack dev-server usage inside a VM, so I don't think we need those modifications. :/ Or maybe add a link to it... I don't know. |
|
Thanks for this contribution, but as @Kocal said, this is probably covered in other articles already. Let's close for now, but we can reconsider this decision in the future when we receive more feedback from the community. Thanks. |
This is the discussion, for setting an absolute url as publicPath, when you're binding the dev server not to localhost but to any external interface (0.0.0.0) and disable host checking:
symfony/webpack-encore#96
The problem is, that when you bind the dev-server to all interfaces with
--host 0.0.0.0this url will be written to the manifest.json, when versioning is used:`"build/main.js": "http://0.0.0.0:8080/build/main.js",
Instead the external-interface should be used:
`"build/main.js": "http://192.168.1.1:8080/build/main.js"
When in docker, you need a port mapping, to make the dev-server accessible, when browsing the site with a browser running on the host.
(please note, that it isn't possible to access docker containers with their internal ip from the host, when running docker on windows. That's why we should always recommend a host-port-mapping for the docker-container)
best regards
philipp