opened
ssameh
username_0
## AOT

```
[ ] Bug Report
[ ] Feature Request
```

## Description
I have a library that includes a module with static method "withComponents" 
`static withComponents(components: Array<any>): ModuleWithProviders {
    return {
      ngModule: DynamicModule,
      providers: [
        { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: components, multi: true }
      ]
    };`

I am able to package and run the library in AOT mode
However when I attempt to refer the package module in my web application and call the static method at the main module imports section 
`imports[MyModule.withComponents([])]`
I get the following AOT error 

"Function calls are not supported in decorators"

If i moved my module directly to my application I don't get the AOT error

#### Version Information
Library Packages
"ng-packagr": "4.2.0",
"@angular/animations": "6.1.8",
"@angular/cdk": "6.4.7",
"@angular/common": "^6.1.8",
"@angular/compiler": "6.1.8",
"@angular/core": "6.1.8",
"@angular/forms": "6.1.8",
"@angular/http": "6.1.8",
"@angular/material": "6.4.7",
"@angular/platform-browser": "6.1.8",
"@angular/platform-browser-dynamic": "6.1.8",
 "rxjs": "6.3.2",
  "zone.js": "0.8.26"

Web application packages
@angular-devkit/architect       0.8.3
@angular-devkit/build-angular   0.8.3
@angular-devkit/build-webpack   0.8.3
@angular-devkit/core            0.8.3
@angular-devkit/schematics      0.8.3
@angular/cdk                    6.4.7
@angular/cli                    6.2.3
@angular/material               6.4.7
@schematics/angular             0.8.3
@schematics/update              0.8.3
ng-packagr                      4.2.0
rxjs                            6.3.2
typescript                      2.9.2
webpack                         4.19.1
Function calls are not supported in decorators
issue
created
JoostK
username_1
Oh no, the dreaded error 😬

Please have a look at https://github.com/angular/angular/issues/23609 where this issue is discussed. There should be some pointers you could attempt.

Also see https://github.com/ng-packagr/ng-packagr/issues/727 for related issue in ng-packagr, although that has been closed as the issue is believed to be in Angular.
comment
created
ssameh
username_0
Hi Joost
I have tried all these already with no luck ? I am using angular cli latest version and i have feeling it doesnt respect the tsconfig settings .

In angular.json production there is tsconfig key, when i set it to point to my tsconfig file i started to get other errors plus AOT so i endes up by reverting everything back

Sameh
comment