Parsing errors on saving any file inside snippets/ folder #3577
equinusocio
started this conversation in
Bugs & Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)Beta Was this translation helpful? Give feedback.
All reactions