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.

ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'ChartModule' was called.

See original GitHub issue

I installed angular2-highcharts on my Angular Project, implemented that. Its working but in ng serve mode. But when I executed the command ng build --prod. I got the error : Error during template compile of ‘AppModule’ Function calls are not supported in decorators but ‘ChartModule’ was called. Its working fine when i executed ng build.

Here is my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic }  from '@angular/platform-browser-dynamic';
import { NgModule } from '@angular/core';
import { ChartModule } from 'angular2-highcharts';
import { AppComponent } from './app.component';
import { HttpModule } from '@angular/http';

declare var require : any;

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,HttpModule,
    ChartModule.forRoot(require('highcharts/highstock'),require('highcharts/modules/drilldown')),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

4reactions
AbdulRayhmancommented, Feb 28, 2018

For me this works:

`//File: app.module.ts import { ChartModule } from ‘angular2-highcharts’; import { HighchartsStatic } from ‘angular2-highcharts/dist/HighchartsService’;

export function highchartsFactory() { const hc = require(‘highcharts/highstock’); const dd = require(‘highcharts/modules/exporting’); dd(hc); return hc; }

//Section: Imports imports:[ChartModule],

//Section: Providers providers:[ { provide: HighchartsStatic, useFactory: highchartsFactory } ]`

0reactions
k1ng440commented, Feb 20, 2018

same issue here. someone please fix it

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in Error during template compile of 'AppModule ...
Function calls are not supported in decorators but ChartModule was called. Its working fine when i executed ng build . Here is my...
Read more >
Error during template compile of 'HomeModule' Function calls ...
ERROR is Error during template compile of 'HomeModule' Function calls are not supported in decorators but 'ChartModule' was called.
Read more >
Building Angular 6 library fails, with a vague error.
BUILD ERROR. Error during template compile of 'Injectable'. Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Read more >
Javascript – How to get rid of Function calls are not supported in ...
ERROR in Error during template compile of 'AppModule' Function calls are not supported in decorators but 'ChartModule' was called. Now, i know that...
Read more >
Solving AOT Error in NgRx: Function calls are not supported in ...
ERROR in src/app/app.module.ts(33,25): Error during template compile of ... Function calls are not supported in decorators but 'createAction' was called in ...
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