Skip to content

Lazy loaded modules with strictMetadataEmit: true fails to build with AoT in Angular 8 #31893

Closed

Description

@pawelkondraciuk

🐞 bug report

Affected Package

The issue is caused by package @angular 8.1.0

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.x

Description

If you use AoT along with strictMetadataEmit enabled and have lazy loaded modules AoT build will throw an error.

🔬 Minimal Reproduction

Clone this repo https://github.com/pawelkondraciuk/angular8-example-app and run ng serve --aot

Nutshell:

// tsconfig.json
"angularCompilerOptions": {
  "strictMetadataEmit": true
},
// app-routing.module.ts
{path: '/', loadChildren: () => import('./modules/home/home.module').then(m => m.HomeModule)},

ng serve --aot

🔥 Exception or Error


ERROR in /Users/pawel-kondraciuk/projects/angular8-example-app/src/app/app.module.ts:47:1: Error encountered in metadata generated for exported symbol 'AppModule':
 /Users/pawel-kondraciuk/projects/angular8-example-app/src/app/app.module.ts:78:19: Metadata collected contains an error that will be reported at runtime: Lambda not supported.
  {"__symbolic":"error","message":"Lambda not supported","line":77,"character":18}

🌍 Your Environment

Angular Version:


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


Angular CLI: 8.1.1
Node: 10.16.0
OS: darwin x64
Angular: 8.1.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.801.3
@angular-devkit/build-angular      0.801.3
@angular-devkit/build-ng-packagr   0.801.3
@angular-devkit/build-optimizer    0.801.3
@angular-devkit/build-webpack      0.801.3
@angular-devkit/core               8.1.3
@angular-devkit/schematics         8.1.1
@angular/cdk                       8.1.2
@angular/cli                       8.1.1
@ngtools/webpack                   8.1.3
@schematics/angular                8.1.1
@schematics/update                 0.801.1
ng-packagr                         5.4.3
rxjs                               6.4.0
typescript                         3.4.5
webpack                            4.35.2

Activity

  1. added this to the needsTriage milestone on Jul 29, 2019
  2. alxhub commented on Jul 30, 2019

    @alxhub
    Member

    strictMetadataEmit is a flag for libraries, which shouldn't have any lazy loaded modules at all. It's not meant to be used for applications.

    Closing this issue as it's not actionable for us.

  3. modified the milestones: needsTriage, Backlog on Jul 30, 2019
  4. angular-automatic-lock-bot commented on Sep 15, 2019

    @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.

  5. locked and limited conversation to collaborators on Sep 15, 2019
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions