Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Respect values for devServer.public #671

Merged
merged 2 commits into from
Jan 14, 2018

Conversation

helfi92
Copy link
Member

@helfi92 helfi92 commented Jan 13, 2018

Fixes #669.

@helfi92 helfi92 self-assigned this Jan 13, 2018
@helfi92 helfi92 requested a review from eliperelman January 13, 2018 19:05
@@ -33,7 +32,7 @@ module.exports = (neutrino, opts = {}) => {
historyApiFallback: true,
publicPath: '/',
headers: {
host: `${publicHost}:${port}`
host: publicHost
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this produce when no value is passed for public? What is produced here when the host is overridden?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eliperelman When no value is passed to public and the host is overridden:

module.exports = {
  use: [
    [
      '@neutrinojs/react',
      {
        devServer: {
          host: '0.0.0.0',
          port: 3000,
        }
      }
    ]
  ]
};

Outputs in the inspect mode (relevant snippet):

{
  devServer: {
    headers: {
      host: '0.0.0.0'
    },
    host: '0.0.0.0',
    port: 3000,
    'public': '0.0.0.0',
  },
  entry: {
    index: [
      '/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack-dev-server/client/index.js?http://0.0.0.0',
      '/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/webpack/hot/dev-server.js',
      '/Users/haali/Documents/Mozilla/projects/neutrino-dev/node_modules/react-hot-loader/patch.js',
      '/Users/haali/Documents/Mozilla/projects/todelete/src/index'
    ]
  },

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if public is 0.0.0.0:3000?

@@ -43,7 +43,7 @@ module.exports = (middleware, args, cli) => {
});
} else {
const { devServer } = compiler.options;
const url = `${devServer.https ? 'https' : 'http'}://${devServer.public}`;
const url = `${devServer.https ? 'https' : 'http'}://${devServer.public}:${devServer.port}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my concern as well, because we used to have this. public should also have the port built into it, since the value for public can be host:port. We need to normalize the value in dev-server differently to account for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I know what you mean. Deleting the last commit and pushing something else now.

@helfi92
Copy link
Member Author

helfi92 commented Jan 13, 2018

@eliperelman Let me know if the last commit is what you wanted.

Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@eliperelman eliperelman merged commit 376104e into neutrinojs:master Jan 14, 2018
@eliperelman
Copy link
Member

@helfi92 looks like there's still a problem:

screen shot 2018-01-14 at 8 51 31 pm

@helfi92
Copy link
Member Author

helfi92 commented Jan 15, 2018

@eliperelman What config are you using? Asking so I can replicate on my machine.

@helfi92
Copy link
Member Author

helfi92 commented Jan 15, 2018

Oh, I see. I replicate when I don't provide any custom config for devServer. Will send a patch.

timkelty pushed a commit to timkelty/neutrino that referenced this pull request Jan 17, 2018
* Respect values for devServer.public

* Normalize path
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

2 participants