The remarkAssignFrontMatter plugin captures lastCommitTime in its closure at compiler-creation time
Author: auvosCreated Mar 18, 2026Updated Sep 30, 2026
Labelsbug
Nextra's compileMdx caches the MDX processor per {format, isPageImport}. The remarkAssignFrontMatter plugin captures lastCommitTime in its closure at compiler-creation time. This means the first file compiled locks its git timestamp into the shared cached compiler -- all subsequent files inherit that wrong timestamp regardless of their actual git history.
Fix
Include lastCommitTime in the compiler cache key:
// before
cachedCompilerForFormat[`${format}:${isPageImport}`] ||= createCompiler();
// after
cachedCompilerForFormat[`${format}:${isPageImport}:${lastCommitTime}`] ||= createCompiler();Files with the same last-commit date still share a cached compiler (no performance regression for most files). Files with unique timestamps each get their own compiler instance.
Source: shuding/nextra