nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.58k stars 2.25k forks source link

Unable to remove zone.js from Angular library polyfills #26362

Open tutkli opened 3 weeks ago

tutkli commented 3 weeks ago

Current Behavior

Currently, in an angular library there's no way to remove zone.js from the polyfills configuration in project.json as the option is not there.

When running tests in a zoneless configuration, you get the error:

  console.warn
    NG0914: The application is using zoneless change detection, but is still loading Zone.js.Consider removing Zone.js to get the full benefits of zoneless. In applications using the Angular CLI, Zone.js is typically included in the "polyfills" section of the angular.json file.

If you add polyfills: [] to the project.json, you get the error:

// lib/project.json

"targets": {
    "build": {
      // ...
      "options": {
        // ...
        "polyfills": []
      },
      // ....
    }
  }
   NX   'polyfills' is not found in schema

Expected Behavior

Being able to configure polyfills in an angular library project.json

GitHub Repo

No response

Steps to Reproduce

  1. In an angular library, provide the zoneless configuration, as explained here: https://angular.dev/guide/experimental/zoneless#using-zoneless-in-testbed
  2. Run tests

Nx Report

Node   : 20.12.2
OS     : win32-x64
npm    : 10.5.0

nx (global)        : 18.0.4
nx                 : 19.1.1
@nx/js             : 19.1.1
@nx/jest           : 19.1.1
@nx/linter         : 19.1.1
@nx/eslint         : 19.1.1
@nx/workspace      : 19.1.1
@nx/angular        : 19.1.1
@nx/devkit         : 19.1.1
@nx/eslint-plugin  : 19.1.1
@nx/playwright     : 19.1.1
@nrwl/tao          : 19.1.1
@nx/web            : 19.1.1
@nx/webpack        : 19.1.1
typescript         : 5.4.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@testing-library/angular : 15.2.0

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

Coly010 commented 3 weeks ago

Thank you for bringing this issue to our attention! I want to assure you that I will take a look as soon as I can. Your patience and understanding in this matter is greatly appreciated.