hack: use chokidar@2 only on node < 8 (#11560)

This commit is contained in:
Huáng Jùnliàng
2020-10-05 12:24:27 -04:00
committed by GitHub
parent 2a3dfa051a
commit 769669f6f8
3 changed files with 100 additions and 7 deletions

View File

@@ -33,7 +33,8 @@
"source-map": "^0.5.0"
},
"optionalDependencies": {
"chokidar": "^2.1.8"
"chokidar": "^3.4.0",
"chokidarAt2": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"

View File

@@ -116,7 +116,10 @@ process.on("uncaughtException", function (err) {
export function requireChokidar(): Object {
try {
return require("chokidar");
// todo(babel 8): revert `chokidarAt2` hack
return parseInt(process.version) >= 8
? require("chokidar")
: require("chokidarAt2");
} catch (err) {
console.error(
"The optional dependency chokidar failed to install and is required for " +