Open BalaRajendran opened 3 years ago
I'm too facing this same issue in 5.0 version
Any news? Thanks!
Try to import echarts like:
import { NgModule } from '@angular/core';
import { CommonModule, registerLocaleData } from '@angular/common';
import { ChartViewComponent } from './chart-view.component';
import { NgxEchartsModule } from 'ngx-echarts';
- import * as echarts from 'echarts';
import en from '@angular/common/locales/en';
import 'echarts/theme/macarons.js';
registerLocaleData(en);
@NgModule({
declarations: [ChartViewComponent],
exports: [ChartViewComponent],
imports: [
CommonModule,
- NgxEchartsModule.forRoot({ echarts }),
+ NgxEchartsModule.forRoot({ echarts: () => import('echarts') }),
],
})
export class ChartViewModule {}
Try to import echarts like:
import { NgModule } from '@angular/core'; import { CommonModule, registerLocaleData } from '@angular/common'; import { ChartViewComponent } from './chart-view.component'; import { NgxEchartsModule } from 'ngx-echarts'; - import * as echarts from 'echarts'; import en from '@angular/common/locales/en'; import 'echarts/theme/macarons.js'; registerLocaleData(en); @NgModule({ declarations: [ChartViewComponent], exports: [ChartViewComponent], imports: [ CommonModule, - NgxEchartsModule.forRoot({ echarts }), + NgxEchartsModule.forRoot({ echarts: () => import('echarts') }), ], }) export class ChartViewModule {}
Tried but getting while doing production build
ERROR in src/app/components/chart-view/chart-view.module.ts(19,41): Error during template compile of 'ɵ0' Function expressions are not supported in decorators Consider changing the function expression into an exported function.
Any news?
Any news?
Nothing @BanannaLopal
I have found a workaround, put the following before your module definition:
export function loadEcharts() {
return import('echarts');
}
And then use this to import echarts:
NgxEchartsModule.forRoot({
echarts: loadEcharts
})
Even with @zliebersbach the error persists.
Even with @zliebersbach the error persists.
+1 on this. Any solution found yet?
Team, I'm getting an error when I trying to do production build. But in development build, it's working fine. With version of echart - ^4.9.0 its working fine
My Package version:
Module