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

Support dev server public option #809

Closed

Conversation

rossta
Copy link
Member

@rossta rossta commented Sep 14, 2017

This PR allows makes the webpack-dev-server public option configurable through webpacker.yml.

We currently use dnsmasq + nginx to reverse proxy requests from a custom local domain, i.e., myapp.dev, to our local Rails server for development. The recent addition of the DevServerProxy makes it easier for us to configure our setup for serving "packs" (thanks!). However, we'd still like the ability to proxy the dev server auto-refresh websocket connection, i.e., the /sockjs-node endpoint, through nginx as well.

To accomplish this (unless I'm missing an alternative), we would set the dev server public option to our local domain myapp.dev; however, the public is currently assumed to be "#{HOSTNAME}:#{PORT}" in the bin/webpack-dev-server wrapper. These changes ensure that a public option given in webpacker.yml or on the command line are passed through to the webpack-dev-server executable.

I could add a section in docs/webpack-dev-server.md if that would be helpful for documentation.

@p0wl
Copy link
Contributor

p0wl commented Sep 15, 2017

nice! needed this just yesterday and wrote a workaround. Would love to see this merged!

In our setup, rails runs in docker but the webpack-dev-server runs on the local machine (because file changes get picked up way faster), so the rails server needs to know the the ip of the webpack-dev-server, but the public option needs to be localhost:3035.

@gauravtiwari
Copy link
Member

gauravtiwari commented Sep 15, 2017

Thanks @rossta for this but we are thinking to move away from ARGV support for webpack-dev-server and instead provide env variables to achieve same behaviour. The config options currently are spread across - cli args, env and webpacker.yml, which makes it harder to reason. Please see this PR: #793 for more details but I am working on another one, which covers your needs as well :)

@rossta
Copy link
Member Author

rossta commented Sep 15, 2017

@gauravtiwari Thanks for the background. Does that mean this PR pre-empted by yours or should I reimplement based on that work after it's merged?

@gauravtiwari
Copy link
Member

@rossta Yepp, the PR will cover your change here :)

@gauravtiwari
Copy link
Member

Closing in favour of #843

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

Successfully merging this pull request may close these issues.

3 participants