angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

Downlevel exclusion list missing after upgrade to Angular 17 #27755

Closed ZissisT closed 3 months ago

ZissisT commented 3 months ago

Command

build, serve

Is this a regression?

The previous version in which this bug was not present was

Angular 16.x.x

Description

After Angular17 upgrade, esbuild is the default for new projects. In earlier versions that used webpack, this issue was solved with https://github.com/angular/angular-cli/pull/22629 (@dgp1130 , @alan-agius4 ). It had to do with excluding 'erroneous' modules that did not support downleveling, eg. whatwg-url. Now this exclusion list seems gone since esbuild uses different configuration. As a result app can not be loaded. Also mentioning that while using native federation as well which has a custom esbuilder I think, same thing happens.

Minimal Reproduction

Exception or Error

utils.js:34 
Uncaught TypeError: Cannot convert undefined or null to object
    at Function.getPrototypeOf (<anonymous>)
    at node_modules/whatwg-url/lib/utils.js (utils.js:34:39)
    at __require (chunk-4XRL6O37.js?v=c3c77883:41:50)
    at node_modules/whatwg-url/lib/URL.js (URL.js:4:15)
    at __require (chunk-4XRL6O37.js?v=c3c77883:41:50)
    at node_modules/whatwg-url/webidl2js-wrapper.js (webidl2js-wrapper.js:3:13)
    at __require (chunk-4XRL6O37.js?v=c3c77883:41:50)
    at node_modules/whatwg-url/index.js (index.js:3:34)
    at __require (chunk-4XRL6O37.js?v=c3c77883:41:50)
    at index.js:27:46

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 18.0.2
Node: 20.13.1
Package Manager: npm 10.8.0
OS: linux x64

Angular: 18.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.2
@angular-devkit/build-angular   18.0.2
@angular-devkit/core            18.0.2
@angular-devkit/schematics      18.0.2
@angular/cli                    18.0.2
@schematics/angular             18.0.2
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

Anything else relevant?

No response

alan-agius4 commented 3 months ago

Unfortunately, with esbuild, it is no longer possible to exclude certain dependencies from being processed. Additionally, all environments and browsers officially supported by Angular natively support the WHATWG URL Standard's URL API, rendering the use of this module redundant.

As described in the previous issue, this is quite trivial to fix at the library level and ensure compatibility with various processing and bundling methods: https://github.com/angular/angular-cli/issues/21735#issuecomment-915974013. Therefore, I recommend either reaching out to the library author or removing this module from your dependencies.

angular-automatic-lock-bot[bot] commented 2 months ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.