Skip to content

Cannot create property 'message' on string @angular\common\fesm2022\common.mjs: Unsupported syntax, expected a string literal. #51411

@psarno

Description

@psarno

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes

Description

We upgraded to 16.2.0 and are getting the following error on build.

Any ideas?

Cannot create property 'message' on string '@angular\common\fesm2022\common.mjs: Unsupported syntax, expected a string literal.


  6275 |     }
  6276 |     static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NgOptimizedImage, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
> 6277 |     static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: NgOptimizedImage, isStandalone: true, selector: "img[ngSrc]", inputs: { ngSrc: "ngSrc", ngSrcset: "ngSrcset", sizes: "sizes", width: ["width", "width", numberAttribute], height: ["height", "height", numberAttribute], loading: "loading", priority: ["priority", "priority", booleanAttribute], loaderParams: "loaderParams", disableOptimizedSrcset: ["disableOptimizedSrcset", "disableOptimizedSrcset", booleanAttribute], fill: ["fill", "fill", booleanAttribute], src: "src", srcset: "srcset" }, host: { properties: { "style.position": "fill ? \"absolute\" : null", "style.width": "fill ? \"100%\" : null", "style.height": "fill ? \"100%\" : null", "style.inset": "fill ? \"0px\" : null" } }, usesOnChanges: true, ngImport: i0 }); }
  6278 | }
  6279 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NgOptimizedImage, decorators: [{
  6280 |             type: Directive,' [plugin angular-compiler]

    src/app/app.module.ts:6:25:
      6 │ import { DatePipe } from '@angular/common';
        ╵                          ~~~~~~~~~~~~~~~~~

  This error came from the "onLoad" callback registered here:

    node_modules/@angular-devkit/build-angular/src/builders/browser-esbuild/angular/compiler-plugin.js:247:18:
      247 │             build.onLoad({ filter: /\.[cm]?js$/ }, (args) => (0, ...
    at setup (@angular-devkit\build-angular\src\builders\browser-esbuild\angular\compiler-plugin.js:247:19)
    at async handlePlugins (esbuild\lib\main.js:1326:9)

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

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


Angular CLI: 16.2.0
Node: 18.16.0
Package Manager: npm 9.6.7
OS: win32 x64

Angular: 16.2.1
... animations, cdk, common, compiler, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.6
@angular-devkit/build-angular   16.0.6
@angular-devkit/core            16.0.6
@angular-devkit/schematics      16.2.0
@angular/cli                    16.2.0
@angular/compiler-cli           16.0.6
@schematics/angular             16.2.0
rxjs                            7.8.1
typescript                      4.9.3
zone.js                         0.13.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions