File tree 2 files changed +9
-3
lines changed 2 files changed +9
-3
lines changed 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
5
5
6
6
## Unreleased
7
7
8
+ - Use ` createRequire ` instead of ` createRequireFromPath ` if available ([ #1602 ] , thanks [ @iamnapo ] )
9
+
10
+ ## v2.5.1 - 2020-01-11
11
+
8
12
### Fixed
9
13
- Uses createRequireFromPath to resolve loaders ([ #1591 ] , thanks [ @arcanis ] )
10
14
- 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.
62
66
### Fixed
63
67
- ` unambiguous.test() ` regex is now properly in multiline mode
64
68
65
-
69
+ [ #1602 ] : https://github.com/benmosher/eslint-plugin-import/pull/1602
66
70
[ #1591 ] : https://github.com/benmosher/eslint-plugin-import/pull/1591
67
71
[ #1551 ] : https://github.com/benmosher/eslint-plugin-import/pull/1551
68
72
[ #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.
84
88
[ @JounQin ] : https://github.com/JounQin
85
89
[ @arcanis ] : https://github.com/arcanis
86
90
[ @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'
18
18
const fileExistsCache = new ModuleCache ( )
19
19
20
20
// 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 ) {
22
23
const mod = new Module ( filename , null )
23
24
mod . filename = filename
24
25
mod . paths = Module . _nodeModulePaths ( path . dirname ( filename ) )
@@ -33,7 +34,7 @@ function tryRequire(target, sourceFile) {
33
34
try {
34
35
// Check if the target exists
35
36
if ( sourceFile != null ) {
36
- resolved = createRequireFromPath ( sourceFile ) . resolve ( target )
37
+ resolved = createRequire ( path . resolve ( sourceFile ) ) . resolve ( target )
37
38
} else {
38
39
resolved = require . resolve ( target )
39
40
}
You can’t perform that action at this time.
0 commit comments