You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this use case, the ESM-Loader loads the fs-extra module with it's internal cjs loader. Because quibble restores the Module._cache entry, the cjs loader only returns an empty object for the exports: TypeError: fse.stat is not a function
Hint:
If I remove the line delete Module._cache[filename] (in doAndRestoreCache) my use-case works.
I think the ESM Loader reads the exports from the cached value after quibble deleted it.
If I use require to load fs-extra, there is no problem:
I want to fake the
fs
package usingmemfs
. My production code usesfs-extra
.The require-stack looks like:
app.js (ESM) -> fs-extra (CJS) -> graceful-fs (CJS) -> fs (Built-In)
Reproduction
Example:
In this use case, the ESM-Loader loads the fs-extra module with it's internal cjs loader. Because quibble restores the
Module._cache
entry, the cjs loader only returns an empty object for the exports:TypeError: fse.stat is not a function
Hint:
If I remove the line
delete Module._cache[filename]
(indoAndRestoreCache
) my use-case works.I think the ESM Loader reads the exports from the cached value after quibble deleted it.
If I use require to load fs-extra, there is no problem:
The text was updated successfully, but these errors were encountered: