File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -354,9 +354,10 @@ export async function discoverCommands(
354
354
maybeImportedConfig = await import ( maybeConfigPath ) ;
355
355
} catch ( error ) {
356
356
if (
357
- isModuleNotFoundSystemError ( error ) &&
358
- ( error . moduleName ?. endsWith ( maybeConfigPath ) ||
359
- error . url ?. endsWith ( maybeConfigPath ) )
357
+ isUnknownFileExtensionError ( error ) ||
358
+ ( isModuleNotFoundSystemError ( error ) &&
359
+ ( error . moduleName ?. endsWith ( maybeConfigPath ) ||
360
+ error . url ?. endsWith ( maybeConfigPath ) ) )
360
361
) {
361
362
debug_ . warn (
362
363
'a recoverable failure occurred while attempting to load configuration: %O' ,
@@ -1343,3 +1344,14 @@ function isModuleNotFoundSystemError(error: unknown): error is Error & {
1343
1344
( error . code === 'MODULE_NOT_FOUND' && 'moduleName' in error ) )
1344
1345
) ;
1345
1346
}
1347
+
1348
+ /**
1349
+ * Type-guard for Node's "ERR_UNKNOWN_FILE_EXTENSION" so-called `SystemError`s.
1350
+ */
1351
+ function isUnknownFileExtensionError ( error : unknown ) : error is Error & {
1352
+ code : 'ERR_UNKNOWN_FILE_EXTENSION' ;
1353
+ } {
1354
+ return (
1355
+ isNativeError ( error ) && 'code' in error && error . code === 'ERR_UNKNOWN_FILE_EXTENSION'
1356
+ ) ;
1357
+ }
You can’t perform that action at this time.
0 commit comments