Skip to content

class private methods are not enabled #24411

Closed
@dzonatan

Description

@dzonatan

Command

build, serve

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

15.0.2

Description

Class private methods no longer works with @angular-devkit/[email protected].

Minimal Reproduction

  • ng new repro-app
  • add an empty private method to the app.component.ts, e.g.:
    #myPrivateMethod() {}
  • ng serve

Exception or Error

./src/app/app.component.ts - Error: Module build failed (from ./node_modules/@angular-devkit/build-a
ngular/src/babel/webpack-loader.js):
SyntaxError: /Users/dzonatan/dev/sandbox/ng15/src/app/app.component.ts: Class private methods are no
t enabled. Please add `@babel/plugin-proposal-private-methods` to your configuration.
  37 |     
> 38 |     #myPrivateMethod() {
     |     ^
  39 |     }
...

Your Environment

Angular CLI: 15.0.3
Node: 16.18.0
Package Manager: npm 8.19.2
OS: darwin arm64

Angular: 15.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.3
@angular-devkit/build-angular   15.0.3
@angular-devkit/core            15.0.0
@angular-devkit/schematics      14.2.9
@angular/cdk                    15.0.2
@schematics/angular             15.0.3
ng-packagr                      15.0.3
rxjs                            7.5.7
typescript                      4.8.4

Anything else relevant?

I believe #24357 was a cause.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions