Skip to content

Prod Mode Compiling Out TypeScript decorator metadata from external project #10584

@amcdnl

Description

@amcdnl

Observed behavior

The cli in prod mode is compiling out the typescript decorator (custom decorator) metadata from a external project compiled using ng-packagr.

An example of the decorator metadata would be:

__decorate([
    Action(Navigate),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Navigate]),
    __metadata("design:returntype", void 0)
], RouterState.prototype, "navigate", null);

The result can be seen in this screenshot on the left:

img

It seems to be related to only external projects. I'm using the same custom decorator used in this code in my project and it works fine.

Desired behavior

It not to compile this out.

Repro steps

  • npm i @ngxs/router-plugin @ngxs/store
  • Include the store and router plugin in your project like so:
@NgModule({
  imports: [
    NgxsModule.forRoot([]),
    NgxsRouterPluginModule.forRoot()
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}
  • Build the application in production
  • Inspect the source and note the decorate metadata was compiled out

For reference here is the compiled code

Versions

Node 10
Npm 6
Mac
"@angular/cli": "^6.0.0-rc.8",

Mention any other details that might be useful (optional)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions