Skip to content

Commit

Permalink
fix: sync fs esm library after patching cjs version (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard authored Nov 16, 2022
1 parent 6b06cb0 commit 58e3d60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/private/node-patches/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ if (
JS_BINARY__PATCH_NODE_FS != '0' &&
JS_BINARY__FS_PATCH_ROOTS
) {
const fs = require('fs')
const fs = require('node:fs')
const module = require('node:module')
const roots = JS_BINARY__FS_PATCH_ROOTS.split(':')
if (JS_BINARY__LOG_DEBUG) {
console.error(
`DEBUG: ${JS_BINARY__LOG_PREFIX}: node fs patches will be applied with roots: ${roots}`
)
}
patchfs(fs, roots)

// Sync the esm modules to use the now patched fs cjs module.
// See: https://nodejs.org/api/esm.html#builtin-modules
module.syncBuiltinESMExports()
}

0 comments on commit 58e3d60

Please sign in to comment.