Description
What problem does this feature solve?
Currently it is not possible to run the vue-cli serve behind a SSL proxy, since the cli hardcodes the HMR endpoint:
vue-cli/packages/@vue/cli-service/lib/commands/serve.js
Lines 102 to 115 in e48a956
Ideally, the HMR requests would also be routed through the proxy, eliminating the need for any additional configuration of vue-cli (adding SSL certificates, etc).
As per the webpack documentation (https://webpack.js.org/configuration/dev-server/#devserverpublic), by default the client will guess the HMR endpoint based in window.location
, which would solve this issue. However, there is no way to avoid the above mentioned hardcoding unless we're running the cli in a container, which is not really a solution.
A common use-case for this is how ASP.Net now does SPA integration; they proxy the SPA content to the actual framework dev servers (directly to create-react-app, etc). A Vue.js implementation of this has been made (https://github.com/EEParker/aspnetcore-vueclimiddleware), but it cannot alter the HMR endpoint without also modifying the dev server endpoint, which results in already occupied ports. The closest solution today is to edit the vue configuration to match each devs environment with something like:
module.exports = {
devServer: {
public: 'https://localhost:44393/'
}
};
What does the proposed API look like?
Update vue.config.js with additional option:
module.exports = {
devServer: {
clientsidePublicInference: true
}
}
Would be nice if a command line parameter would also be available, or environment variables, so tools like the above mentioned "aspnetcore-vueclimiddleware" can set this option without modifying configuration.