Skip to content

Build application with prerender routes file fails #27251

Closed
@wendevlin

Description

@wendevlin

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

I migrated my app to Angular 17 --> works as expected.

Now I want to get rid of my webpack build.

So I migrate my prerendering to @angular-devkit/build-angular:application:


          "builder": "@angular-devkit/build-angular:application",
          "options": {
              "outputPath": "dist/browser",
              "index": "src/index.html",
              "browser": "src/main.ts",
              "polyfills": [ "src/polyfills.ts" ],
              "tsConfig": "tsconfig.app.json",
              "inlineStyleLanguage": "scss",
              "assets": [
                "src/favicon.ico",
                "src/assets",
                "src/sitemap.xml",
                "src/robots.txt"
              ],
              "styles": [
                "src/styles.scss"
              ],
              "scripts": [],
              "prerender": {
                "discoverRoutes": false,
                "routesFile": "routes.txt"
              }
          },
....

when I run then the build with ng build I get following error:

An unexpected error occurred: [object Object]
error: script "build" exited with code 1

This only happens when prerender options is:

              "prerender": {
                "discoverRoutes": false,
                "routesFile": "routes.txt"
              }
              "prerender": {
                "routesFile": "routes.txt"
              }
              "prerender": {
                "discoverRoutes": true,
              }
              "prerender":  true

my routes.txt is correct.

Please provide a link to a minimal reproduction of the bug

https://github.com/WhizUs-Labs/angular-prerender-test

Please provide the exception or error you saw

An unexpected error occurred: [object Object]
error: script "build" exited with code 1

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.2.3
Node: 20.11.1
Package Manager: bun 1.0.30
OS: linux x64

Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.3
@angular-devkit/build-angular   17.2.3
@angular-devkit/core            17.2.3
@angular-devkit/schematics      17.2.3
@angular/cdk                    17.2.2
@angular/cli                    17.2.3
@angular/google-maps            17.2.2
@angular/ssr                    17.2.3
@schematics/angular             17.2.3
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions