Skip to content

Commit 927a2b3

Browse files
nekolabmichael-ciniawsky
authored andcommitted
fix(Server): correct node version checks (#1543)
1 parent fa96a76 commit 927a2b3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Diff for: lib/Server.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const https = require('https');
2020
const spdy = require('spdy');
2121
const sockjs = require('sockjs');
2222

23+
const semver = require('semver');
24+
2325
const killable = require('killable');
2426

2527
const del = require('del');
@@ -46,8 +48,7 @@ const schema = require('./options.json');
4648
// breaking connection when certificate is not signed with prime256v1
4749
// change it to auto allows OpenSSL to select the curve automatically
4850
// See https://github.com/nodejs/node/issues/16196 for more infomation
49-
const version = parseFloat(process.version.slice(1));
50-
if (version >= 8.6 && version < 10) {
51+
if (semver.satisfies(process.version, '8.6.0 - 9')) {
5152
tls.DEFAULT_ECDH_CURVE = 'auto';
5253
}
5354

@@ -592,7 +593,7 @@ function Server (compiler, options = {}, _log) {
592593
// - https://github.com/nodejs/node/issues/21665
593594
// - https://github.com/webpack/webpack-dev-server/issues/1449
594595
// - https://github.com/expressjs/express/issues/3388
595-
if (version >= 10) {
596+
if (semver.gte(process.version, '10.0.0')) {
596597
this.listeningApp = https.createServer(options.https, app);
597598
} else {
598599
this.listeningApp = spdy.createServer(options.https, app);

Diff for: package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"portfinder": "^1.0.9",
4545
"schema-utils": "^1.0.0",
4646
"selfsigned": "^1.9.1",
47+
"semver": "^5.6.0",
4748
"serve-index": "^1.7.2",
4849
"sockjs": "0.3.19",
4950
"sockjs-client": "1.3.0",

0 commit comments

Comments
 (0)