File tree 1 file changed +10
-2
lines changed
@commitlint/load/src/utils
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
- import { cosmiconfig } from 'cosmiconfig' ;
1
+ import { cosmiconfig , type Loader } from 'cosmiconfig' ;
2
2
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader' ;
3
3
import path from 'path' ;
4
4
@@ -13,7 +13,15 @@ export async function loadConfig(
13
13
configPath ?: string
14
14
) : Promise < LoadConfigResult | null > {
15
15
const moduleName = 'commitlint' ;
16
- const tsLoader = TypeScriptLoader ( ) ;
16
+
17
+ let tsLoaderInstance : Loader | undefined ;
18
+ const tsLoader : Loader = ( ...args ) => {
19
+ if ( ! tsLoaderInstance ) {
20
+ tsLoaderInstance = TypeScriptLoader ( ) ;
21
+ }
22
+ return tsLoaderInstance ( ...args ) ;
23
+ } ;
24
+
17
25
const explorer = cosmiconfig ( moduleName , {
18
26
searchPlaces : [
19
27
// cosmiconfig overrides default searchPlaces if any new search place is added (For e.g. `*.ts` files),
You can’t perform that action at this time.
0 commit comments