Custom angular builder/nx executor

Discussão em 'Angular' iniciado por Øystein Amundsen, Janeiro 16, 2025.

  1. I'm trying to hook up code to be executed after the regular angular build process. Angular supports custom builders, so I'm trying to implement one. It is implemented inside an NX workspace, so this is what I got so far.

    Commands executed:

    nx g @nx/plugin:plugin tools/builder
    nx generate @nx/plugin:executor tools/builder/src/executors/application/application
    nx generate @nx/plugin:executor tools/builder/src/executors/dev-server/dev-server


    Github repo with my code: https://github.com/OysteinAmundsen/home/tree/pwa/tools/builder

    The builder is used in my project.json as follows:

    "targets": {
    "build": {
    "executor": "@home/builder:application",
    ...
    "serve": {
    "executor": "@home/builder:dev-server",


    It is supposed to run the angular build first, then allow me to hook something up when it is done. But I'm not getting that far. When I try to run this, it outputs the following message:

    NX implementation is not a function
    TypeError: implementation is not a function
    at runExecutorInternal (C:\dev\home\node_modules\nx\src\command-line\run\run.js:98:19)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at C:\dev\home\node_modules\nx\src\command-line\run\run.js:176:44
    at handleErrors (C:\dev\home\node_modules\nx\src\utils\handle-errors.js:8:24)
    at process.<anonymous> (C:\dev\home\node_modules\nx\bin\run-executor.js:59:28)


    I checked the implementation path in my executors.json and it is correctly pointing to the executors. I know it can find them, because if I change the path slightly I get a different error message; Could not resolve "./src/executors/application1" from "C:\dev\home\tools\builder".

    I do not know if it is nescessary to build out my executor or not before I run it, but this has also been tried to no effect. I've also checked that the paths in my executor.json is correct after build, but nx does not seem to care if the project is built or not.

    What am I doing wrong?

    Continue reading...

Compartilhe esta Página