mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-05 00:57:27 +00:00
14 lines
376 B
JavaScript
14 lines
376 B
JavaScript
// https://github.com/facebook/jest/issues/12270#issuecomment-1194746382
|
|
|
|
const nativeModule = require('node:module');
|
|
|
|
function resolver(module, options) {
|
|
const { basedir, defaultResolver } = options;
|
|
try {
|
|
return defaultResolver(module, options);
|
|
} catch (error) {
|
|
return nativeModule.createRequire(basedir).resolve(module);
|
|
}
|
|
}
|
|
|
|
module.exports = resolver;
|