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(
111111| restrictions | [ ] | A list of resolve restrictions |
112112| roots | [ ] | A list of root paths |
113113| 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. |
115115| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
116116
117117## Plugins
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ function createOptions(options) {
297297 preferRelative : options . preferRelative || false ,
298298 preferAbsolute : options . preferAbsolute || false ,
299299 restrictions : new Set ( options . restrictions ) ,
300- tsconfig : options . tsconfig || "" ,
300+ tsconfig : options . tsconfig || "auto " ,
301301 } ;
302302}
303303
Original file line number Diff line number Diff line change @@ -20,21 +20,21 @@ const { modulesResolveHandler } = require("./ModulesUtils");
2020 * @property {string= } context - Context directory for resolving relative paths
2121 */
2222
23+ const DEFAULT_CONFIG_FILE = "tsconfig.json" ;
24+
2325module . exports = class TsconfigPathsPlugin {
2426 /**
25- * @param {string } configFile tsconfig file path
27+ * @param {"auto" | string } configFile tsconfig file path
2628 */
2729 constructor ( configFile ) {
28- this . configFile = configFile ;
30+ this . configFile = configFile === "auto" ? DEFAULT_CONFIG_FILE : configFile ;
2931 }
3032
3133 /**
3234 * @param {Resolver } resolver the resolver
3335 * @returns {void }
3436 */
3537 apply ( resolver ) {
36- if ( ! this . configFile ) return ;
37-
3838 const aliasTarget = resolver . ensureHook ( "internal-resolve" ) ;
3939 const moduleTarget = resolver . ensureHook ( "module" ) ;
4040 const aliasOptionsPromise = this . loadAndConvertPaths ( resolver ) ;
You can’t perform that action at this time.
0 commit comments