diff --git a/src/node/contentLoader.ts b/src/node/contentLoader.ts index 228d83a5e2f5..6eaf8be648b5 100644 --- a/src/node/contentLoader.ts +++ b/src/node/contentLoader.ts @@ -49,6 +49,13 @@ export interface ContentOptions { * bundle if imported from components or markdown files. */ transform?: (data: ContentData[]) => T | Promise + + /** + * Options to pass to `fast-glob`. + * You'll need to manually specify `node_modules` and `dist` in + * `globOptions.ignore` if you've overridden it. + */ + globOptions?: glob.Options } export interface ContentData { @@ -72,7 +79,8 @@ export function createContentLoader( includeSrc, render, excerpt: renderExcerpt, - transform + transform, + globOptions }: ContentOptions = {} ): { watch: string | string[] @@ -106,7 +114,8 @@ export function createContentLoader( // the loader is being called directly, do a fresh glob files = ( await glob(pattern, { - ignore: ['**/node_modules/**', '**/dist/**'] + ignore: ['**/node_modules/**', '**/dist/**'], + ...globOptions }) ).sort() }