Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

Future proof #4

Merged
merged 2 commits into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

var _ = require('underscore');
var fs = require('fs');
var path = require('path');
var Module = require('module');

var originalWrapper = Module.wrapper.slice(0);
Expand Down
14 changes: 6 additions & 8 deletions lib/requizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
var _ = require('underscore');
var loader = require('./loader');
var Module = require('module');
var path = require('path');

/**
* Function that returns text to swizzle into the module.
Expand Down Expand Up @@ -40,13 +39,12 @@ var path = require('path');
*/

function isNativeModule(targetPath, parentModule) {
var lookupPaths = Module._resolveLookupPaths(targetPath, parentModule);

if (lookupPaths[0] === targetPath && lookupPaths[1].length === 0) {
return true;
}

return false;
var lookupPaths = Module._resolveLookupPaths(targetPath, parentModule, true);
/* istanbul ignore next */
return lookupPaths === null ||
lookupPaths.length === 2 &&
lookupPaths[1].length === 0 &&
lookupPaths[0] === targetPath;
}

/**
Expand Down