dotnet-foundation / dotnet-foundation/projects
## Bug description
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 157
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
Bug description
When saving any file inside snippets/ during mint dev, the terminal fills with MDX parsing errors from files inside node_modules. Despite node_modules being listed in DEFAULT_MINT_IGNORES and in .mintignore, the errors still appear on every file save.
Steps to reproduce
- Create a Mintlify project with
node_modulespresent (standard setup) - Add any
.jsxfile tosnippets/, e.g.snippets/MyComponent.jsx - Run
mint dev - Save
snippets/MyComponent.jsx - Observe parsing errors for files in
node_modulesprinted to the terminal
Expected behavior
No errors from node_modules — those files should be ignored, as documented in .mintignore and DEFAULT_MINT_IGNORES.
Actual behavior
On every save of a snippet file, dozens of errors like:
parsing error ./node_modules/.pnpm/@biomejs+biome@2.4.3/node_modules/@biomejs/biome/README.es.md:28:2 - Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a comment in MDX, use `{/* text */}`)
parsing error ./node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/CHANGELOG.md:49:71 - Unexpected character `8` ...
Root cause
The issue is in @mintlify/previewing. Several functions use getFileListSync from @mintlify/prebuild, which recursively scans all files without applying any ignore patterns.
packages/previewing/src/local-preview/listener/generatePagesWithImports.ts (triggered on every snippet save):
const pageFilenames = getFileListSync(CMD_EXEC_PATH).filter((file) => {
if (!isSnippetExtension(getFileExtension(file))) return false;
const category = getFileCategory(file, { importedFiles });
return category === 'page'; // ← node_modules/*.md files pass this check
});
getFileListSync has no awareness of .mintignore or DEFAULT_MINT_IGNORES:
// @mintlify/prebuild - fs/index.ts
export const getFileListSync = (dirName: string, og = dirName): string[] => {
const files: string[] = [];
const items = readdirSync(dirName, { withFileTypes: true });
for (const item of items) {
const fullPath = path.join(dirName, item.name);
if (item.isDirectory()) {
files.push(...getFileListSync(fullPath, og)); // ← recurses into node_modules
} else {
files.push(toPosixPath(path.relative(og, fullPath)));
}
}
return files;
};
By contrast, the async getFileList correctly applies isMintIgnored:
export async function* getFileList(dirName, og = dirName, mintIgnore = []) {
const items = await readdir(dirName, { withFileTypes: true });
for (const item of items) {
const relativePath = toPosixPath(path.relative(og, fullPath));
if (isMintIgnored(relativePath, mintIgnore)) continue; // ✅ filters node_modules
// ...
}
}
The same issue exists in getSnippets.ts and importCache.ts (fallback path).
Suggested fix
getFileListSync should accept an optional mintIgnore parameter and apply isMintIgnored, mirroring the async getFileList:
export const getFileListSync = (
dirName: string,
og = dirName,
mintIgnore: string[] = []
): string[] => {
const files: string[] = [];
const items = readdirSync(dirName, { withFileTypes: true });
for (const item of items) {
const fullPath = path.join(dirName, item.name);
const relativePath = toPosixPath(path.relative(og, fullPath));
if (isMintIgnored(relativePath, mintIgnore)) continue; // ← add this
if (item.isDirectory()) {
files.push(...getFileListSync(fullPath, og, mintIgnore));
} else {
files.push(relativePath);
}
}
return files;
};
All callers (generatePagesWithImports, getSnippets, importCache) would then need to pass the result of getMintIgnoreGlobs().
Environment
mintversion: 4.2.367- Package manager: pnpm (with
.pnpmvirtual store layout)
Originally posted by @equinusocio in https://github.com/mintlify/docs/discussions/3577
Originally posted by @ifteneiftene in https://github.com/mintlify/docs/issues/3680
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/previewing/src/local-preview/listener/generatePagesWithImports.ts and trace its getFileListSync call during snippet saves. Then inspect getSnippets.ts, importCache.ts, and @mintlify/prebuild's synchronous and asynchronous file-list functions, including their ignore handling. Done means node_modules files are excluded during preview updates and all three callers still discover the intended project files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100