diff --git a/src/index.ts b/src/index.ts index e965e9e..9fe79e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -148,6 +148,7 @@ async function loadConfigFile(filepath: string, source: LoadConfigSource): parentURL: filepath, cache: false, loader: source.loader || 'auto', + fallbackLoaders: source.fallbackLoaders, }) dependencies = r.getModuleInfo(mod)?.dependencies return interopDefault(mod) diff --git a/src/types.ts b/src/types.ts index 60d8df8..1dfbab1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -29,6 +29,15 @@ export interface LoadConfigSource { */ loader?: SupportedLoader | 'auto' + /** + * Fallback loaders when the previous loader failed. + * + * Set to `false` to disable fallback. + * + * Default to importx's default. + */ + fallbackLoaders?: SupportedLoader[] | false + /** * Rewrite the config object, * return nullish value to bypassing loading the file