Parsing errors on saving any file inside snippets/ folder #3577
Replies: 2 comments
|
Any feedback or consideration about this fix? |
|
Adding a version comparison for the same synchronous scanner, including a stack overflow caused by large ignored directories. Observed on mint 4.2.788Environment: macOS, Node.js 24.11.1, mint 4.2.788, @mintlify/cli 4.0.1391, and @mintlify/prebuild 1.0.1231.
The checkout contained nested Git worktrees and their pnpm dependencies. The A small synthetic Verified with mint 4.2.1047I installed mint 4.2.1047 separately, with @mintlify/cli 4.0.1650, @mintlify/prebuild 1.0.1412, and @mintlify/link-rot 3.0.1468. The same 130,000-entry fixture passed both with and without This confirms that the tested |
Uh oh!
There was an error while loading. Please reload this page.
Bug description
When saving any file inside
snippets/duringmint dev, the terminal fills with MDX parsing errors from files insidenode_modules. Despitenode_modulesbeing listed inDEFAULT_MINT_IGNORESand in.mintignore, the errors still appear on every file save.Steps to reproduce
node_modulespresent (standard setup).jsxfile tosnippets/, e.g.snippets/MyComponent.jsxmint devsnippets/MyComponent.jsxnode_modulesprinted to the terminalExpected behavior
No errors from
node_modules— those files should be ignored, as documented in.mintignoreandDEFAULT_MINT_IGNORES.Actual behavior
On every save of a snippet file, dozens of errors like:
Root cause
The issue is in
@mintlify/previewing. Several functions usegetFileListSyncfrom@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):getFileListSynchas no awareness of.mintignoreorDEFAULT_MINT_IGNORES:By contrast, the async
getFileListcorrectly appliesisMintIgnored:The same issue exists in
getSnippets.tsandimportCache.ts(fallback path).Suggested fix
getFileListSyncshould accept an optionalmintIgnoreparameter and applyisMintIgnored, mirroring the asyncgetFileList:All callers (
generatePagesWithImports,getSnippets,importCache) would then need to pass the result ofgetMintIgnoreGlobs().Environment
mintversion: 4.2.367.pnpmvirtual store layout)All reactions