Skip to content

Commit d141150

Browse files
committed
Do not use spdy on Node 10
`spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. Fixes: webpack#1449 Fixes: nodejs/node#21665
1 parent e1bd264 commit d141150

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/Server.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ require('./polyfills');
55

66
const fs = require('fs');
77
const http = require('http');
8+
const https = require('https');
89
const path = require('path');
910
const url = require('url');
1011
const chokidar = require('chokidar');
@@ -484,7 +485,20 @@ function Server(compiler, options, _log) {
484485
};
485486
}
486487

487-
this.listeningApp = spdy.createServer(options.https, app);
488+
// `spdy` is effectively unmaintained, and as a consequence of an
489+
// implementation that extensively relies on Node’s non-public APIs, broken
490+
// on Node 10 and above. In those cases, only https will be used for now.
491+
// Once express supports Node's built-in HTTP/2 support, migrating over to
492+
// that should be the best way to go.
493+
// The relevant issues are:
494+
// - https://github.com/nodejs/node/issues/21665
495+
// - https://github.com/webpack/webpack-dev-server/issues/1449
496+
// - https://github.com/expressjs/express/issues/3388
497+
if (+process.version.match(/^v(\d+)/[1]) >= 10) {
498+
this.listeningApp = https.createServer(options.https, app);
499+
} else {
500+
this.listeningApp = spdy.createServer(options.https, app);
501+
}
488502
} else {
489503
this.listeningApp = http.createServer(app);
490504
}

0 commit comments

Comments
 (0)