Skip to content

Webpack type error with latest @types/node in Angular 18 #30265

@Yogu

Description

@Yogu

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Can we update to [email protected] in the 18.2.x branch? It fixes webpack/webpack#19498, which is a type error that is occuring since a recent @types/node version.

I saw that webpack was recently updated on main #30260, but 18.2.x is still using an older webpack version. Is it planned to update webpack on 18.2.x in this case to fix the type error?

Minimal Reproduction

I get the error when building a storybook app based on Angular 18.2. Please let me know if providing a reproduction is helpful, then I'll try to set up a public repro.

Exception or Error

node_modules/webpack/types.d.ts:14856:15 - error TS2417: Class static side 'typeof WebpackError' incorrectly extends base class static side '{ readonly prototype: Error; captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; prepareStackTrace(err: Error, stackTraces: CallSite[]): any; stackTraceLimit: number; }'.
  Types of property 'prepareStackTrace' are incompatible.
    Type '((err: Error, stackTraces: CallSite[]) => any) | undefined' is not assignable to type '(err: Error, stackTraces: CallSite[]) => any'.
      Type 'undefined' is not assignable to type '(err: Error, stackTraces: CallSite[]) => any'.

14856 declare class WebpackError extends Error {
                    ~~~~~~~~~~~~

Your Environment

Angular CLI: 18.2.19
Node: 20.18.2
Package Manager: npm 10.8.2
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.10
@angular-devkit/build-angular   18.2.19
@angular-devkit/core            19.2.10
@angular-devkit/schematics      18.2.19
@angular/cdk                    18.2.14
@angular/cli                    18.2.19
@angular/material               18.2.14
@schematics/angular             18.2.19
ng-packagr                      18.2.1
rxjs                            7.8.2
typescript                      5.4.5
zone.js                         0.14.10

Anything else relevant?

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