File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ myResolver.resolve(
111
111
| restrictions | [ ] | A list of resolve restrictions |
112
112
| roots | [ ] | A list of root paths |
113
113
| symlinks | true | Whether to resolve symlinks to their symlinked location |
114
- | tsconfig | "tsconfig.json " | Path to the tsconfig.json file to use for paths mapping |
114
+ | tsconfig | "auto " | Path to the tsconfig.json file to use for paths mapping, The default value "auto" means it will try to load tsconfig.json. |
115
115
| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
116
116
117
117
## Plugins
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ function createOptions(options) {
297
297
preferRelative : options . preferRelative || false ,
298
298
preferAbsolute : options . preferAbsolute || false ,
299
299
restrictions : new Set ( options . restrictions ) ,
300
- tsconfig : options . tsconfig || "" ,
300
+ tsconfig : options . tsconfig || "auto " ,
301
301
} ;
302
302
}
303
303
Original file line number Diff line number Diff line change @@ -20,21 +20,21 @@ const { modulesResolveHandler } = require("./ModulesUtils");
20
20
* @property {string= } context - Context directory for resolving relative paths
21
21
*/
22
22
23
+ const DEFAULT_CONFIG_FILE = "tsconfig.json" ;
24
+
23
25
module . exports = class TsconfigPathsPlugin {
24
26
/**
25
- * @param {string } configFile tsconfig file path
27
+ * @param {"auto" | string } configFile tsconfig file path
26
28
*/
27
29
constructor ( configFile ) {
28
- this . configFile = configFile ;
30
+ this . configFile = configFile === "auto" ? DEFAULT_CONFIG_FILE : configFile ;
29
31
}
30
32
31
33
/**
32
34
* @param {Resolver } resolver the resolver
33
35
* @returns {void }
34
36
*/
35
37
apply ( resolver ) {
36
- if ( ! this . configFile ) return ;
37
-
38
38
const aliasTarget = resolver . ensureHook ( "internal-resolve" ) ;
39
39
const moduleTarget = resolver . ensureHook ( "module" ) ;
40
40
const aliasOptionsPromise = this . loadAndConvertPaths ( resolver ) ;
You can’t perform that action at this time.
0 commit comments