forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Allow for explicit URL binding (other than localhost) to support WSL2 #70

Open jastend opened 4 years ago

jastend commented 4 years ago

Is your feature request related to a problem? Please describe. Because of the significant performance improvement compared to developing straight on Windows, I use WSL2 inside VSCode for my development. Unfortunately, this breaks the websocket connection and thus the automatic Browser refresh functionality.

WebSocket connection to 'ws://127.0.0.1:9856/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Describe the solution you'd like Other reload services, like Browsersync, allow you to pass additional configuration parameters to circumvent this. E.g. when developing a web application, I can set the Base URI to "dev.test", bind this internally in my hosts config and utilize the explicit binding (instead of localhast).

Here's how such a configuration might look like (it's taken straight out of an unrelated project that I work one which utilizes Laravel - I'm aware that you can't convert this 1:1):

mix.browserSync({
    open: false,
    host: process.env.MIX_APP_BASE_URI,
    proxy: {
        target: process.env.MIX_APP_BASE_URI,
        reqHeaders: function () {
            return {
                host: process.env.MIX_APP_BASE_URI + ":3000"
            }
        }
    }
});

Describe alternatives you've considered Alternatively, it might be sufficient to allow to whitelist alternative bind URLs other than localhost, since Windows will appear as a 172.x.x.x address inside WSL2. Though, I do believe allowing for explicit binding might provide more flexibility.

Additional context I'm aware that the workaround is quite easy (just reload manually), but it would be nice if you could consider implementing such additional config parameters.

stale[bot] commented 4 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

git2gus[bot] commented 4 years ago

This issue has been linked to a new work item: W-7703823

git2gus[bot] commented 4 years ago

This issue has been linked to a new work item: W-7736987