dotCMS / dotCMS/core

NX build fails due to missing Vite timestamp files after branch changes

Open
#32,961 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Build dotCMS : Technical Debt Frontend Priority : 2 High Team : Platform
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

  1. Vite generates temporary timestamp files during compilation of .mts (TypeScript module) configuration files
  2. NX's dependency analysis caches references to these temporary files
  3. After branch changes or clean builds, these files are removed but NX still tries to access them
  4. The existing ignorePatterns in nx.json only affect file watching/caching, not dependency analysis

Steps to Reproduce

  1. Run a build that compiles Vite configuration files (generates timestamp files)
  2. Switch branches or perform a clean build (removes timestamp files)
  3. Run yarn nx build dotcms-ui or similar NX command
  4. 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
  1. ignorePatterns (already existed): Handles file watching and caching
  2. namedInputs exclusions (new): Prevents NX from analyzing these files during dependency graph creation
  3. Combined approach: Ensures timestamp files are ignored in all NX operations
Files Modified
  • core-web/nx.json: Added timestamp file exclusions to namedInputs.default and namedInputs.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 ignorePatterns functionality preserved

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.