From 5aacd628adbd416717b30249266849f1c525c043 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Tue, 2 Jan 2024 13:22:36 -0800 Subject: [PATCH] Revert "fs: remove workaround for `esm` package" This reverts commit 95b198911382b0aa0a0448e2a86214558665e02b. It appears that the workaround is still needed: issue #51081 Backport-PR-URL: https://github.com/nodejs/node/pull/51390 PR-URL: https://github.com/nodejs/node/pull/51390 Fixes: https://github.com/nodejs/node/issues/51081 Reviewed-By: Marco Ippolito --- lib/internal/fs/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index f38e225ef7c593..dde2244ac0655e 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -500,6 +500,10 @@ function Stats(dev, mode, nlink, uid, gid, rdev, blksize, ObjectSetPrototypeOf(Stats.prototype, StatsBase.prototype); ObjectSetPrototypeOf(Stats, StatsBase); +// HACK: Workaround for https://github.com/standard-things/esm/issues/821. +// TODO(ronag): Remove this as soon as `esm` publishes a fixed version. +Stats.prototype.isFile = StatsBase.prototype.isFile; + Stats.prototype._checkModeProperty = function(property) { if (isWindows && (property === S_IFIFO || property === S_IFBLK || property === S_IFSOCK)) {