Skip to content

feat: support @angular/build as an optional replacement for @angular-devkit/build-angular in Angular 19 Component TestingΒ #30903

Open
@jcompagner

Description

@jcompagner

Current behavior

Angular 19 doesn't use devkit (webpack) anymore by default. In Cypress 14 I get this error:

Error: Could not resolve "@angular-devkit/build-angular/src/utils/webpack-browser-config.js". Do you have "@angular-devkit/build-angular" and "@angular-devkit/core" installed?
    at C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:106:19
    at Array.map (<anonymous>)
    at getAngularCliModules (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:100:151)
    at async getAngularCliWebpackConfig (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:159:101)
    at async angularHandler (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:205:27)
    at async getPreset (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:62:20)
    at async Function.devServer.create (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:79:61)
    at async C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:22:24

because we don't use the webpack builder anymore, we use purely the @angular/build:application builder.

Also the schematics of the angular upgrade from 18 to 19 will remove the npm package: "@angular-devkit/build-angular" and adds the package:
"@angular/build"

Is cypress able to run with the new builder and not webpack?

Desired behavior

cypress should run with the new application builder (esbuild) instead of webpack which is not used anymore by angular itself

Test code to reproduce

here is our component test:
https://github.com/Servoy/servoy-extra-components

here is the angular.json that has the applicaiton builder (of the dummy project used by cypress)

https://github.com/Servoy/servoy-extra-components/blob/master/angular.json#L37

Cypress Version

14

Node version

v22.11.0

Operating System

windows 11

Debug Logs

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CTIssue related to component testingnpm: @cypress/angular@cypress/angular package issuestype: featureNew feature that does not currently exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions