Skip to content

optimization error when switching from 15.0.5 to 15.1.0 #24526

Closed

Description

@jnizet

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

15.0.5

Description

When switching from version 15.0.5 to version 15.1.0 of the CLI, the ng build command fails with the following error:

Error: Optimization error [main.4718ba8213dd7bf6.js]: SyntaxError: Unexpected token: punc (()

Minimal Reproduction

See jnizet/decouvertes-nature#521.

To reproduce locally:

  • clone the project
  • checkout to the branch renovate/angular-cli-monorepo
  • run yarn
  • run ng build

Exception or Error

Error: Optimization error [main.4718ba8213dd7bf6.js]: SyntaxError: Unexpected token: punc (()


### Your Environment

```text
Angular CLI: 15.1.0
Node: 16.15.0
Package Manager: yarn 1.22.19
OS: darwin x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.0
@angular-devkit/build-angular   15.1.0
@angular-devkit/core            15.1.0
@angular-devkit/schematics      15.1.0
@angular/fire                   7.5.0
@schematics/angular             15.1.0
rxjs                            7.8.0
typescript                      4.8.4


### Anything else relevant?

_No response_

Activity

  1. atsjo commented on Jan 11, 2023

    @atsjo

    same for me...

  2. leonelvsc commented on Jan 11, 2023

    @leonelvsc

    Same here

  3. clydin commented on Jan 11, 2023

    @clydin
    Member

    This appears to be a bug in esbuild which is used within the optimization pipeline. A fix with esbuild will most likely be needed to resolve the issue.

  4. atsjo commented on Jan 11, 2023

    @atsjo

    the newly released esbuild 0.16.17 fixes this. confirmed by overriding esbuild dependency via

      "resolutions": {
        "@angular-devkit/build-angular/esbuild": "^0.16.17"
      }
    
  5. added a commit that references this issue on Jan 12, 2023
    848d200
  6. added 2 commits that reference this issue on Jan 12, 2023
    b68467f
    b94bf60
  7. kwhjvdkamp commented on Jan 12, 2023

    @kwhjvdkamp

    Thanks @anisaboud ! Unfortunately, no luck! See, #48722

  8. clydin commented on Jan 12, 2023

    @clydin
    Member

    For any projects encountering this issue, please update the Angular CLI to 15.1.1.

  9. angular-automatic-lock-bot commented on Feb 12, 2023

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions