Angular universal: how to prerender a routesFile in a multi configuration project

279 Views Asked by At

Angular universal: how to prerender a routesFile in a multi configuration project

I have an angular project that has multiple configurations

I installed the express-engine using the command

`ng add @nguniversal/express-engine`

I have also updated the prerender section in the angular.json file to configure the prerender for the multiple configuration that I have

but when run the command to prerender the routes using

ng run TMS:prerender:local-taxica

I face the following error

An unhandled exception occurred: Configuration 'local-taxica' is not set in the workspace.
    See "C:\Users\Systems\AppData\Local\Temp\ng-sIkcAL\angular-errors.log" for further details.

the log file output is as follows : -

    [error] Error: Configuration 'local-taxica' is not set in the workspace.
        at Object.getOptions (C:\Users\Systems\source\repos\TMS-Abp4\angular-public-booking\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:47:31)
        at WorkspaceNodeModulesArchitectHost.getOptionsForTarget (C:\Users\Systems\source\repos\TMS-Abp4\angular-public-booking\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:126:49)
        at async Promise.all (index 1)

here is how prerender section look like

        "prerender": {
          "builder": "@nguniversal/builders:prerender",
          "options": {
            "browserTarget": "TMS:build:production",
            "serverTarget": "TMS:server:production",
            "routesFile": "src/routes-files/local-taxica.txt"
          },
          "configurations": {
            "production": {
              "browserTarget": "TMS:build:production",
              "serverTarget": "TMS:server:production"
            },
             
             ...

            "local-taxica": {
              "browserTarget": "TMS:build:local-taxica",
              "serverTarget": "TMS:server:local-taxica"
            },

            . . .
          }
        }

FYR have also included full copies of the files that I have in case you need them to locate the problem

https://abatchi.com/downloads/angular-changes/angular.json https://abatchi.com/downloads/angular-changes/package.json

I have also made an envireoment file for local-taxica and here is a copy of it https://abatchi.com/downloads/angular-changes/environment.local-taxica.ts

I tried many thing and solved a few problem until I reached this but nothing of what I did seem to be relevant to this exact situation

0

There are 0 best solutions below