Smarter query string for client entry, also works for script #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My use-case is that I require HTTPS and have set-up an nginx proxy in a directory
/webpack-dev-server/
for webpack-dev-server. This allows me to use certificates and basically pretend that webpack-dev-server doesn't exist. However,/socket.io/
is "hard-coded" and cannot be changed currently, this allows it to be replaced with any URL.This PR significantly improves the query string and also enables it for the script tag.
Currently, the only supported syntax is:
'webpack-dev-server/client?http://domain'
...
/socket.io
is implicit.This adds support for paths:
'webpack-dev-server/client?https://domain/webpack-dev-server/socket.io'
...
/socket.io
is no longer implicit when a path is present.It also adds support for relative paths:
'webpack-dev-server/client?/webpack-dev-server/socket.io'
'webpack-dev-server/client?socket.io'
... is equivalent if the bundle is loaded from
/webpack-dev-server/bundle.js
.Also, as I mentioned, script tags support the same syntax:
<script src="/webpack-dev-server/bundle.js?http://put.it/somewhere/else/socket.io"></script>
Caution though, I haven't tested this extensively and I haven't tested the script tag at all (but I did test it manually in the code and it seemed fine) as I'm not sure how the
index.bundle.js
is created. The code is complicated a bit by the fact that URLs are currently required (by webpack-dev-server) to not have a tailing/
which is technically incorrect as they really are directories and not files.👍 for a kick-ass project.
If someone finds it useful, I use the following nginx configuration (the tailing slash for
proxy_pass
is important!):