monorepo - Nx run build command gets in a loop and cache is missing - Stack Overflow

admin2025-04-18  4

Based on the picture I've shared.

I'm starting with the monorepo. So actually having that structure.

I am looking to run commands and build it. If i do nx run build it will be building the root "exampleName" that I thought it will be looking for all the project.json in the workspace and then build everything but it runs nothing and it gets into a loop because I have set in the package.json file a command build that runs nx run build again.

But I don't know how to just run nx run build and make it happen running all targets build from different project.json files.

I have actually tried:

"scripts": {
  "build:all": "nx run-many --target=build --all --exclude=exampleName"
}

exampleName(name of the folder where its the root of everything) is detected as a project even tho it just contains the folders where everything starts.

Also I am trying to use the cache adding in the nx.json file cache: true. But it doesnt say anything in the pipelines as it if were cached and it builds successfully with nx run-many command.

转载请注明原文地址:http://www.anycun.com/QandA/1744926669a89587.html