Skip to content

Repository files navigation

Polyfill Error

This project reproduces the following build error in Angular SSR:

✘ [ERROR] Could not resolve "zone.js/node"

    angular:polyfills-server:angular:polyfills-server:1:7:
      1 │ import 'zone.js/node';
        ╵        ~~~~~~~~~~~~~~

This issue was reproduced in Angular 22.

How to Reproduce

To reproduce this error, do the following:

  1. Create a new Angular 22 SSR project:
ng new polyfill-error --ssr --style sass --ai-config none
  1. Edit the project and add a file named polyfills.ts in the root directory.

  2. Edit the angular.json file and add a reference to polyfills.ts in the build options:

      "architect": {
        "build": {
          "builder": "@angular/build:application",
          "options": {
            "polyfills":["polyfills.ts"],
  1. Add polyfills.ts to files in tsconfig.app.json:
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": [
      "node"
    ]
  },
  "files": ["polyfills.ts"],
  1. Build the application:
npm run build

Note that an error is reported.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages