Skip to content

Localized bundle generation failed: Unexpected reserved word 'let' #20814

Closed
@submarines-and

Description

@submarines-and

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • prerender
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, it worked in angular 11.

Description

Angular build fails with message:

✖ Localized bundle generation failed: /path/to/project/main.js: Unexpected reserved word 'let'. (1:2980997)
An error occurred inlining file "main.js"

Issue feels similar to this one, i.e. that some dependency has a strange coding pattern.The error refers to "main.js", which I presume is stored in memory. Is there a way to save this to disk? If so, I can search it to find the exact violating code.

Suspect list:

  • Babel
  • Localization
  • Server side rendering (universal)
  • Pre-rendering

🔬 Minimal Reproduction

  1. ng new loc-error
  2. ng add @angular/localize
  3. ng add @nguniversal/express-engine
  4. Add "localize": true to angular.json for server and browser build targets
  5. Add "serverTarget": "loc-error:server:production" to prerender step
  6. yarn prerender

Link to minimal repository with this setup:
https://github.com/submarines-and/angular-localization-error

🔥 Exception or Error

image

🌍 Your Environment



Angular CLI: 12.0.0
Node: 14.15.5
Package Manager: npm 6.14.11
OS: darwin x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.0
@nguniversal/builders           12.0.0
@nguniversal/express-engine     12.0.0
@schematics/angular             12.0.0
rxjs                            6.6.7
typescript                      4.2.4

Localization on
Server side rendering (universal) on
Pre-rendering on.

yarn version 1.22.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions