nx icon indicating copy to clipboard operation
nx copied to clipboard

vite.config.mts.timestamp files not being cleaned

Open kaliatech opened this issue 1 year ago โ€ข 9 comments

Current Behavior

After recent upgrade to Nx 18, running a build across projects will sometimes output vite.config.mts.timestamp files named like this:

  • vite.config.mts.timestamp-1709230079565-76a89799c5908.mjs

It doesn't happen every time. We see one file for each project. We are also frequently, but seemingly randomly, seeing this error:

  • Failed to process project dependencies with "nx/js/dependencies-and-lockfile"

After that error, running the same build command again always works. We're not sure if these two items are related and I can file separate bug reports if worthwhile.

These issues are happening with a fairly standard Nx 18.0.5 setup using the react and vite generator configurations. One change we made is the rename of vite.config.ts, to vite.config.mts, to support ESM imports in the vite config.

Expected Behavior

We would expect those vite.config.mts timestamp files to not exist on the filesystem after running build tasks.

GitHub Repo

No response

Steps to Reproduce

This is the build command used in the npm script:

  1. nx run-many --all --target=build --runner=default

Nx Report

Node   : 20.11.1
OS     : linux-x64
npm    : 10.4.0

nx                 : 18.0.5
@nx/js             : 18.0.5
@nx/linter         : 18.0.5
@nx/eslint         : 18.0.5
@nx/workspace      : 18.0.5
@nx/devkit         : 18.0.5
@nx/eslint-plugin  : 18.0.5
@nx/playwright     : 18.0.5
@nx/react          : 18.0.5
@nrwl/tao          : 18.0.5
@nx/vite           : 18.0.5
@nx/web            : 18.0.5
typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

  • [ ] macOS
  • [X] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

No response

kaliatech avatar Feb 29 '24 18:02 kaliatech

Same issue

borisovdev avatar Mar 12 '24 15:03 borisovdev

Had the same issue. Adding vite.config.mts.timestamp-* to .gitignore solved it for us. Had a hunch this would stop the NX Daemon from caring about these files as it must surely respect git ignores, and it seems to have worked so far. ๐Ÿ˜„

vaunus avatar Mar 14 '24 16:03 vaunus

@JamesHenry just to let you know, this also happens with

vitest.config.ts.timestamp-*

MaximeBernard avatar May 16 '24 13:05 MaximeBernard

Also, for reproduction, it seems to happen when we git rebase.

MaximeBernard avatar May 16 '24 13:05 MaximeBernard

Is this issue still reproducible on the latest version of Nx?

The vite.config.mts.timestamp files are something that vite produces during its configuration loading. It should get cleaned up right away and not cause issues. We've also made it so that the Nx Daemon ignores those changes: https://github.com/nrwl/nx/pull/21514 so I'm curious if this is still an issue.

FrozenPandaz avatar Jul 25 '24 19:07 FrozenPandaz

I have not seen this issue in some time, but I'm also no longer working with Nx consistently. Still, given the information above, I would recommend closing this issue.

kaliatech avatar Jul 25 '24 20:07 kaliatech

Apparently the issue was resolved.

Before, when we switched branches or rebased, temporary vite/vitest files were added into our repo. Now, when doing so, no xxx timestamp is added.

I re-ran the script nx run-many --all --target=build --runner=default and still didn't have those files.

chan-nguyen avatar Aug 01 '24 13:08 chan-nguyen

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Aug 09 '24 00:08 github-actions[bot]

I'm still seeing this issue on 19.6.2

cjlawson02 avatar Aug 27 '24 18:08 cjlawson02

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Sep 04 '24 00:09 github-actions[bot]

This is still an issue on 19.7.2.

Fairly easy to reproduce, just run yarn nx show project {projectname} with vite.config.mjs or .js file and reload the config (I think .ts is fixed per https://github.com/nrwl/nx/pull/21514 but not sure why it was only scoped to .ts files)

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 C:\\repos\\catalog.web-v2\\apps\\mobile\\vite.config.js.timestamp-1726077370021-231456b0b4d81.mjs: The system cannot find the file specified. (os error 2)\nUnable to load C:\\repos\\catalog.web-v2\\apps\\mobile\\vite.config.js.timestamp-1726077370022-686e0fca3d51c.mjs: The system cannot find the file specified. (os error 2)"
        at buildExplicitTypeScriptDependencies (C:\repos\catalog.web-v2\node_modules\nx\src\plugins\js\project-graph\build-dependencies\explicit-project-dependencies.js:50:21)
        at buildExplicitDependencies (C:\repos\catalog.web-v2\node_modules\nx\src\plugins\js\project-graph\build-dependencies\build-dependencies.js:32:120)
        at Object.createDependencies (C:\repos\catalog.web-v2\node_modules\nx\src\plugins\js\index.js:81:92)
        at LoadedNxPlugin.createDependencies (C:\repos\catalog.web-v2\node_modules\nx\src\project-graph\plugins\internal-api.js:60:59)
        at createDependencies (C:\repos\catalog.web-v2\node_modules\nx\src\project-graph\plugins\isolation\plugin-worker.js:88:49)
        at consumeMessage (C:\repos\catalog.web-v2\node_modules\nx\src\project-graph\plugins\isolation\messaging.js:38:32)
        at C:\repos\catalog.web-v2\node_modules\nx\src\project-graph\plugins\isolation\plugin-worker.js:21:47
        at Socket.<anonymous> (C:\repos\catalog.web-v2\node_modules\nx\src\utils\consume-messages-from-socket.js:13:17)
        at Socket.emit (node:events:519:28)
        at addChunk (node:internal/streams/readable:559:12)

I can confirm, adding *.timestamp-* or similar to gitignore will fix this locally so nx doesn't pick it up.

B-Stewart avatar Sep 11 '24 18:09 B-Stewart

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Sep 19 '24 00:09 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Nov 10 '24 00:11 github-actions[bot]