@@ -15,6 +15,7 @@ const path = require('path');
15
15
const ip = require ( 'ip' ) ;
16
16
const url = require ( 'url' ) ;
17
17
const http = require ( 'http' ) ;
18
+ const https = require ( 'https' ) ;
18
19
const spdy = require ( 'spdy' ) ;
19
20
const sockjs = require ( 'sockjs' ) ;
20
21
@@ -571,7 +572,20 @@ function Server (compiler, options = {}, _log) {
571
572
} ;
572
573
}
573
574
574
- this . listeningApp = spdy . createServer ( options . https , app ) ;
575
+ // `spdy` is effectively unmaintained, and as a consequence of an
576
+ // implementation that extensively relies on Node’s non-public APIs, broken
577
+ // on Node 10 and above. In those cases, only https will be used for now.
578
+ // Once express supports Node's built-in HTTP/2 support, migrating over to
579
+ // that should be the best way to go.
580
+ // The relevant issues are:
581
+ // - https://github.com/nodejs/node/issues/21665
582
+ // - https://github.com/webpack/webpack-dev-server/issues/1449
583
+ // - https://github.com/expressjs/express/issues/3388
584
+ if ( + process . version . match ( / ^ v ( \d + ) / ) [ 1 ] >= 10 ) {
585
+ this . listeningApp = https . createServer ( options . https , app ) ;
586
+ } else {
587
+ this . listeningApp = spdy . createServer ( options . https , app ) ;
588
+ }
575
589
} else {
576
590
this . listeningApp = http . createServer ( app ) ;
577
591
}
0 commit comments