@@ -37,10 +37,44 @@ export type Resolver = LegacyResolver | NewResolver
37
37
38
38
export type ResolvedResult = ResultFound | ResultNotFound
39
39
40
- export interface NodeResolverOptions {
41
- extensions ?: readonly string [ ]
42
- moduleDirectory ?: string [ ]
43
- paths ?: string [ ]
40
+ export interface NodeResolverOptions
41
+ extends Omit < NapiResolveOptions , 'extensions' > {
42
+ /** Directory to begin resolving from (defaults to __dirname) */
43
+ basedir ?: string
44
+ /** Set to false to exclude node core modules (e.g. fs) from the search */
45
+ includeCoreModules ?: boolean
46
+ /** Array of file extensions to search in order (defaults to ['.js']) */
47
+ extensions ?: string | readonly string [ ]
48
+ /**
49
+ * Require.paths array to use if nothing is found on the normal node_modules
50
+ * recursive walk (probably don't use this)
51
+ */
52
+ paths ?: string | readonly string [ ]
53
+ /**
54
+ * Directory (or directories) in which to recursively look for modules.
55
+ * (default to 'node_modules')
56
+ */
57
+ moduleDirectory ?: string | readonly string [ ]
58
+ /**
59
+ * If true, doesn't resolve `basedir` to real path before resolving. This is
60
+ * the way Node resolves dependencies when executed with the
61
+ * --preserve-symlinks flag.
62
+ *
63
+ * Note: this property is currently true by default but it will be changed to
64
+ * false in the next major version because Node's resolution algorithm does
65
+ * not preserve symlinks by default.
66
+ */
67
+ preserveSymlinks ?: boolean
68
+
69
+ // The following options are not supported anymore, but kept for compatibility
70
+ /** @deprecated */
71
+ package ?: unknown
72
+ /** @deprecated */
73
+ packageFilter ?: unknown
74
+ /** @deprecated */
75
+ pathFilter ?: unknown
76
+ /** @deprecated */
77
+ packageIterator ?: unknown
44
78
}
45
79
46
80
export interface WebpackResolverOptions {
@@ -65,7 +99,7 @@ export type LegacyResolverResolveImport<T = unknown> = (
65
99
modulePath : string ,
66
100
sourceFile : string ,
67
101
config : T ,
68
- ) => string | undefined
102
+ ) => string
69
103
70
104
export type LegacyResolverResolve < T = unknown > = (
71
105
modulePath : string ,
0 commit comments