toolsplus / nx-forge

Atlassian Forge plugin for Nx
https://toolsplus.github.io/nx-forge/
MIT License
17 stars 4 forks source link

Project dependencies are ignored during build #104

Closed vladnega closed 5 months ago

vladnega commented 5 months ago

When following the Getting Started tutorial, the npx nx build <nx-forge-app-name> command fails with a message similar to:

Project <custom-ui-app-name> has no build artifacts in output directory 'dist\apps\<custom-ui-app-name>'. Make sure the project produces compatible build artifacts.

I believe this is because the latest version of nx doesn't build dependent apps by default when running nx build <app-name>, especially if the apps aren't referencing each other in the source code. The fix is to edit the nx.json file to add:

"targetDefaults": {
    "build": {
      "dependsOn": ["^build"]
    }
  }

The latest version available at the time of writing is v18.2.3.

Maybe you could update your Getting Started page to reflect this extra step, or automate it in the plugin somehow? 😄

tbinna commented 5 months ago

Thanks for highlighting this @vladnega. Yes, adding a build targetDefaults should solve the problem. I am not sure about the reason behind why Nx removed this. There may be some details in the Nx changelogs. I will keep this open as a task to update the tutorial.

Regarding adding this to the plugin, it would be good to understand why Nx removed it in the first place from the generator (probably the workspace generator), maybe there is a reason.