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

Get the port from the options object #1079

Closed
wants to merge 2 commits into from
Closed

Conversation

binhqx
Copy link

@binhqx binhqx commented Sep 13, 2017

What kind of change does this PR introduce?
bugfix

Did you add or update the examples/?
No

Summary
When listeningApp is not supplied, use the port from the options object. I think this functionally was broken by PR: https://github.com/webpack/webpack-dev-server/pull/1054/files#diff-07cfeb70272594b38ac9139434c94502

Does this PR introduce a breaking change?
No

Other information

When listeningApp is not supplied, use the port from the options object.
@jsf-clabot
Copy link

jsf-clabot commented Sep 13, 2017

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Sep 13, 2017

Codecov Report

Merging #1079 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1079   +/-   ##
=======================================
  Coverage   72.39%   72.39%           
=======================================
  Files           5        5           
  Lines         460      460           
  Branches      147      147           
=======================================
  Hits          333      333           
  Misses        127      127
Impacted Files Coverage Δ
lib/util/createDomain.js 37.5% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e61972a...724b40f. Read the comment docs.

@@ -6,7 +6,7 @@ const internalIp = require('internal-ip');

module.exports = function createDomain(options, listeningApp) {
const protocol = options.https ? 'https' : 'http';
const appPort = listeningApp ? listeningApp.address().port : 0;
const appPort = listeningApp ? listeningApp.address().port : options.port.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

this will break dynamic port assignment, port 0 was intentional there for that reason.

@shellscape
Copy link
Contributor

What side effects is this causing?

@binhqx
Copy link
Author

binhqx commented Sep 13, 2017

@shellscape
I am using https://github.com/JeffreyWay/laravel-mix to configure webpack in a laravel project. The hot module loader is failing to connect back to the dev server because the port number is missing.

image

@shellscape
Copy link
Contributor

@binhqx this can be resolved by stubbing the listeningApp parameter in addDevServerEntryPoints.js:

{
  address() {
    return { port: options.port };
  }
}

And should allow everything else to function normally. The CLI is doing a few things a little out of order. If we find that we have to stub in more than one place, we'll refactor. But since that's a util function it shouldn't be a big deal.

@shellscape
Copy link
Contributor

@binhqx would you like to do that in your PR or would you like me to?

@binhqx
Copy link
Author

binhqx commented Sep 13, 2017

@shellscape You are much more familiar with the code. You can fix it your way.

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

Successfully merging this pull request may close these issues.

None yet

3 participants