Skip to content

Commit

Permalink
update async version and modify isModule check to account for depreca…
Browse files Browse the repository at this point in the history
…tion of require.extensions
  • Loading branch information
grawk committed Feb 13, 2023
1 parent 3a757ed commit 5c5e37a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function isModule(file) {
// require.resolve will locate a file without a known extension (e.g. txt)
// and try to load it as javascript. That won't work for this case.
var ext = path.extname(file);
return ext === '' || require.extensions.hasOwnProperty(ext);
// in order for this to work after deprecation of module.extensions
var extensions = {'.js': true, '.json': true, '.node': true}
return ext === '' || extensions.hasOwnProperty(ext);
}


Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"jshint": "~2.4.4"
},
"dependencies": {
"core-util-is": "~1.0.1",
"async": "~0.2.10"
"async": "^3.2.4",
"core-util-is": "~1.0.1"
}
}

0 comments on commit 5c5e37a

Please sign in to comment.