File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
55
66## Unreleased
77
8+ - Use ` createRequire ` instead of ` createRequireFromPath ` if available ([ #1602 ] , thanks [ @iamnapo ] )
9+
10+ ## v2.5.1 - 2020-01-11
11+
812### Fixed
913- Uses createRequireFromPath to resolve loaders ([ #1591 ] , thanks [ @arcanis ] )
1014- report the error stack on a resolution error ([ #599 ] , thanks [ @sompylasar ] )
@@ -62,7 +66,7 @@ Yanked due to critical issue with cache key resulting from #839.
6266### Fixed
6367- ` unambiguous.test() ` regex is now properly in multiline mode
6468
65-
69+ [ #1602 ] : https://github.com/benmosher/eslint-plugin-import/pull/1602
6670[ #1591 ] : https://github.com/benmosher/eslint-plugin-import/pull/1591
6771[ #1551 ] : https://github.com/benmosher/eslint-plugin-import/pull/1551
6872[ #1435 ] : https://github.com/benmosher/eslint-plugin-import/pull/1435
@@ -84,3 +88,4 @@ Yanked due to critical issue with cache key resulting from #839.
8488[ @JounQin ] : https://github.com/JounQin
8589[ @arcanis ] : https://github.com/arcanis
8690[ @sompylasar ] : https://github.com/sompylasar
91+ [ @iamnapo ] : https://github.com/iamnapo
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ const ERROR_NAME = 'EslintPluginImportResolveError'
1818const fileExistsCache = new ModuleCache ( )
1919
2020// Polyfill Node's `Module.createRequireFromPath` if not present (added in Node v10.12.0)
21- const createRequireFromPath = Module . createRequireFromPath || function ( filename ) {
21+ // Use `Module.createRequire` if available (added in Node v12.2.0)
22+ const createRequire = Module . createRequire || Module . createRequireFromPath || function ( filename ) {
2223 const mod = new Module ( filename , null )
2324 mod . filename = filename
2425 mod . paths = Module . _nodeModulePaths ( path . dirname ( filename ) )
@@ -33,7 +34,7 @@ function tryRequire(target, sourceFile) {
3334 try {
3435 // Check if the target exists
3536 if ( sourceFile != null ) {
36- resolved = createRequireFromPath ( sourceFile ) . resolve ( target )
37+ resolved = createRequire ( path . resolve ( sourceFile ) ) . resolve ( target )
3738 } else {
3839 resolved = require . resolve ( target )
3940 }
You can’t perform that action at this time.
0 commit comments