1

After I setup SSR for my Angular 18 project, it properly worked. The issue lies on prerender option in project.json. When I change it to false, the project builds without any problem. But when it's true, the build gets stuck in chunk step. Adding --verbose doesn't show anything.

{
  "build": {
      "executor": "@angular-devkit/build-angular:application",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/web-app",
        "index": "./src/index.html",
        "browser": "./src/main.ts",
        "polyfills": ["zone.js"],
        "tsConfig": "tsconfig.app.json",
        "inlineStyleLanguage": "scss",
        "assets": [
          {
            "glob": "**/*",
            "input": "assets",
            "output": "/assets"
          }
        ],
        "styles": ["./src/styles.scss"],
        "scripts": [],
        "server": "./src/main.server.ts",
        "prerender": true, // this is the problem
        "ssr": {
          "entry": "./server.ts"
        }
      },
}

I just set prerender to true and false and found out that the problem is when prerender is set to true.

1
  • What do you mean it gets stuck? Is there an error? Look for any observable that cannot complete during prerendering. Look inside any guard you have as well. You may need to use isPlatformBrowser to ensure that code only executes in the browser. Commented Oct 6, 2024 at 2:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.