Skip to content

Commit

Permalink
Remove dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Aug 11, 2021
1 parent 8d51530 commit 589d329
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/app/components/chart/chart.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter,ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {CommonModule} from '@angular/common';
import * as Chart from 'chart.js';
import Chart from 'chart.js/auto';

@Component({
selector: 'p-chart',
Expand Down Expand Up @@ -79,14 +79,10 @@ export class UIChart implements AfterViewInit, OnDestroy {
opts.maintainAspectRatio = false;
}

import('chart.js/auto').then((module) => {
if (module && module.default) {
this.chart = new module.default(this.el.nativeElement.children[0].children[0], {
type: this.type,
data: this.data,
options: this.options
});
}
this.chart = new Chart(this.el.nativeElement.children[0].children[0], {
type: this.type,
data: this.data,
options: this.options
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"declaration": true,
"module": "es2020",
"module": "es2015",
"target": "es5",
"baseUrl": ".",
"stripInternal": true,
Expand Down

0 comments on commit 589d329

Please sign in to comment.