NX build fails due to missing Vite timestamp files after branch changes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Problem Description
NX builds are failing with dependency graph processing errors when Vite timestamp files are missing after branch changes or clean builds.
Error Details
NX Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it. See errors below.
Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
The "nx/js/dependencies-and-lockfile" plugin threw an error while creating dependencies:
Error: "Unable to load /Users/stevebolton/git/core2/core-web/libs/sdk/analytics/vite.config.mts.timestamp-1754917068812-31d31e538c3f7.mjs: No such file or directory (os error 2)"
at buildExplicitTypeScriptDependencies (/Users/stevebolton/git/core2/core-web/node_modules/nx/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js:50:21)
Root Cause
- Vite generates temporary timestamp files during compilation of .mts (TypeScript module) configuration files
- NX's dependency analysis caches references to these temporary files
- After branch changes or clean builds, these files are removed but NX still tries to access them
- The existing
ignorePatternsin nx.json only affect file watching/caching, not dependency analysis
Steps to Reproduce
- Run a build that compiles Vite configuration files (generates timestamp files)
- Switch branches or perform a clean build (removes timestamp files)
- Run
yarn nx build dotcms-uior similar NX command - Observe the dependency graph processing failure
Expected Behavior
NX builds should succeed regardless of the presence/absence of temporary Vite timestamp files.
Actual Behavior
NX fails to process the project graph and cannot execute build commands.
Solution
Updated core-web/nx.json to exclude Vite timestamp files from dependency analysis by adding exclusion patterns to the namedInputs configuration:
Changes Made
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals",
"\!{projectRoot}/**/*vite.config*.timestamp*",
"\!{projectRoot}/**/*vitest.config*.timestamp*"
],
"production": [
"default",
"\!{projectRoot}/**/*.spec.[jt]s",
// ... other exclusions
"\!{projectRoot}/**/*vite.config*.timestamp*",
"\!{projectRoot}/**/*vitest.config*.timestamp*"
]
}
Why This Works
ignorePatterns(already existed): Handles file watching and cachingnamedInputsexclusions (new): Prevents NX from analyzing these files during dependency graph creation- Combined approach: Ensures timestamp files are ignored in all NX operations
Files Modified
core-web/nx.json: Added timestamp file exclusions tonamedInputs.defaultandnamedInputs.production
Impact
- Severity: High - Blocks frontend builds after branch changes
- Scope: All NX-based builds in core-web workspace
- Workaround: Manual
nx reset(clears cache but loses optimization)
Testing Verification
- ✅ Builds work after branch switches without manual intervention
- ✅ NX dependency analysis no longer references missing timestamp files
- ✅ Build performance not negatively impacted
- ✅ Existing
ignorePatternsfunctionality preserved
Contributor guide
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
Inspect core-web/nx.json, especially the namedInputs.default and namedInputs.production entries, then reproduce the failure with a branch change or clean build followed by yarn nx build dotcms-ui. Done means NX no longer references missing Vite or Vitest timestamp files and the build succeeds without manually running nx reset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vite
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100