question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 9 breaks xi18n

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

In angular 8+ when I use ng xi18n, command runs without error. Since angular 9, it produce an error.

Description

Produced error : Metadata collected contains an error that will be reported at runtime: Lambda not supported.

πŸ”¬ Minimal Reproduction

Try to execut ng xi18n inside a project with lambda.

For example: Set a new route with: { path: 'signin', loadChildren: () => import('./lazy-loader-modules/lazy.module').then(m => m.LazyModule) }

And have a tsconfig like:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": true,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "types": [
      "node",
      "fabric"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "enableIvy": true,
    "allowEmptyCodegenFiles": true,
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true
  }
}

πŸ”₯ Exception or Error

Metadata collected contains an error that will be reported at runtime: Lambda not supported.

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.7
Node: 12.3.1
OS: win32 x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.7
@angular-devkit/build-angular      0.900.7
@angular-devkit/build-ng-packagr   0.900.7
@angular-devkit/build-optimizer    0.900.7
@angular-devkit/build-webpack      0.900.7
@angular-devkit/core               9.0.7
@angular-devkit/schematics         9.0.7
@angular/cdk                       9.1.3
@angular/flex-layout               9.0.0-beta.29
@angular/material                  9.1.3
@ngtools/webpack                   9.0.7
@schematics/angular                9.0.7
@schematics/update                 0.900.7
ng-packagr                         9.0.3
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

Anything else relevant?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
petebacondarwincommented, May 7, 2020

I’m really sorry but the ivy message extraction has missed the cut for 10.0.0. Targeting 10.1.0 now - I have just not had any capacity to work on this over the last few weeks.

The main PR is https://github.com/angular/angular/pull/32912 but this is blocked on https://github.com/angular/angular/pull/36843

6reactions
petebacondarwincommented, Mar 27, 2020

For v9 we did not implement the new i18n message extraction, which parses the Angular component templates and extracts messages that will need to be translated. Instead we resolved to continue to use the pre-ivy extraction mechanism. Unfortunately this old mechanism relies upon the Angular code being compiled by the old ViewEngine compiler, which is not as clever at understanding (and statically evaluating) anonymous functions (aka lambdas).

For v10 we expect to have implemented a new extraction mechanism that does not rely upon the ViewEngine compiler, and so this restriction will go away then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Ultimate Guide to Angular Localization | Phrase
It's no surprise that Angular has robust built-in i18n support. In this step-by-step tutorial on Angular localization and internationalization,Β ...
Read more >
ng extract-i18n - Angular
Option Description Default Value ‑‑format Output format for the generated file. xlf ‑‑out‑file Name of the file to output. ‑‑output‑path Path where output will be placed....
Read more >
Angular translation extraction fails - localization - Stack Overflow
Now I am trying to create a translation file using ng xi18n ... \@angular\localize\src\tools\src\extract\extraction.js:9:3) at Module.
Read more >
Angular i18n: internationalization & localization with examples
This is a new package introduced in Angular 9 that will add ... There is a special command-line tool called xi18n which does...
Read more >
How to translate Angular apps: @angular/localize and xlf
Use the ng xi18n command line tool to extract the translations and create an XLIFF translation file; Translate the messages in the file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found