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

prepareUrls may not build the right localUrlForBrowser for NAT Networks #828

Closed
Toilal opened this issue Feb 12, 2018 · 2 comments
Closed

Comments

@Toilal
Copy link

Toilal commented Feb 12, 2018

What problem does this feature solve?

Hot Module Reload may not work when running yarn serve from a docker container, or when accessing to the dev server from a NAT network that may have a different IP / Port than the configured one inside vue.config.js.

Problem is that client may fail to connect back to the webpack-dev-server because host/port is wrong (webpack/webpack-dev-server#416).

It should be possible to provide options to provide the host/port that should be used to reach the webpack-dev-server from the browser. Those options should be passed to create the right entry point for webpack-dev-server client

What does the proposed API look like?

module.exports = {
  devServer: {
    host: '0.0.0.0',
    port: 1288,
    public: { // To be used by the browser
        host: '192.168.1.100',
        port: 80,
    },
    disableHostCheck: true
  }
}
@Toilal
Copy link
Author

Toilal commented Feb 12, 2018

Possible workaround in vue.config.js

module.exports = {
  configureWebpack: (conf) => {
    conf.entry['app'].push(require.resolve(`webpack-dev-server/client`) + '?http://192.168.1.100:80')
  },
  devServer: {
    host: '0.0.0.0',
    port: 1288,
    disableHostCheck: true
  }
}

antiphoton added a commit to antiphoton/vue-cli that referenced this issue Feb 22, 2018
(vuejs#828)Webpack dev client could not work when server is behind NAT network.

Now, the dev client tries to connect to browser's window.location.
yyx990803 pushed a commit that referenced this issue Mar 1, 2018
(#828)Webpack dev client could not work when server is behind NAT network.

Now, the dev client tries to connect to browser's window.location.
@yyx990803
Copy link
Member

Closed via #868

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

No branches or pull requests

2 participants