Git Product home page Git Product logo

Comments (4)

leosvelperez avatar leosvelperez commented on June 12, 2024

Thanks for reporting this!

The issue happens because of a constraint regarding build target names (https://nx.dev/recipes/angular/setup-incremental-builds-angular#build-target-name). What's happening is that the target with an executor that supports incremental builds in your containers library now has a different name (build-angular) while its dependencies (e.g. the project that contains the file/from/another/lib path) probably still have build. The way incremental builds currently work, the target names should be the same.

We are trying out (and plan to enable it by default) a new way of calculating the target dependencies for incremental builds that should not be constrained by this. Could you try running your command with the NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true env var and let me know if it works?

from nx.

PatoDeVille avatar PatoDeVille commented on June 12, 2024

thanks for your response @leosvelperez but no luck :(

from nx.

leosvelperez avatar leosvelperez commented on June 12, 2024

hey @PatoDeVille! Apologies for the delay in getting back to you.

One thing I missed last time is that we need to make sure the task graph has the correct dependencies so Nx can properly figure out the buildable libs dependencies. To do so, please update your targetDefaults in nx.json and add the following:

{
  ...
  "targetDefaults": {
    ...
    "build-angular": {
      "dependsOn": ["^build"]
    },
  },
  ...
}

With that in place, you can build your library (or app) setting the env var I mentioned in my last comment:

NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true nx build my-lib
NX_BUILDABLE_LIBRARIES_TASK_GRAPH=true nx build my-app

The important bit is that any target using one of the Nx executors that supports incremental builds (e.g. @nx/angular:package) must specify the tasks it depends on. In this case, the build-angular task uses the @nx/angular:package executor, and it depends on projects that use the build task with a similar executor. That's why we need to set up that dependency in the build pipeline. Additionally, the NX_BUILDABLE_LIBRARIES_TASK_GRAPH env var enables a new way of calculating those dependencies relying on the task graph and not just on the target name (previous behavior).

Please let me know if you still have any issues after making the adjustments above.

from nx.

leosvelperez avatar leosvelperez commented on June 12, 2024

I'm closing this since a solution was provided in #22043 (comment) (I tested it in a repo with a similar setup as this issue's description).

@PatoDeVille, if you still have any issues after following the instructions on that comment, please leave a message, and I'll take a look.

from nx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.