Ng2-charts: ReferenceError: Chart is not defined

Created on 21 Apr 2019  Â·  9Comments  Â·  Source: valor-software/ng2-charts

I am getting the below error on universal build:
"ng2-charts": "^2.2.2",
"chart.js": "^2.8.0",

And I have my charts.min.js file included in my angular-cli.json file.

I am building on
Cli version
Angular CLI: 7.3.8
Node: 10.15.3
OS: win32 x64
Angular: 7.2.13

webpack://app/./node_modules/ng2-charts/fesm5/ng2-charts.js?:1057
var helpers = Chart.helpers;
              ^

ReferenceError: Chart is not defined
    at eval (webpack://app/./node_modules/ng2-charts/fesm5/ng2-charts.js?:1057:15)
    at Module../node_modules/ng2-charts/fesm5/ng2-charts.js (E:\websites\site\dist\site-webpack\server.js:7694:1)
    at __webpack_require__ (E:\websites\site\dist\site-webpack\server.js:36:30)
    at Object.ng2-charts (webpack://app/./dist/site-server/main.js?:72157:18)
    at __webpack_require__ (webpack://app/./dist/site-server/main.js?:20:30)
    at Module../src/app/views/app-profile/profile.component.ngfactory.js (webpack://app/./dist/site-server/main.js?:64416:68)
    at __webpack_require__ (webpack://app/./dist/site-server/main.js?:20:30)
    at Module../src/app/views/app-profile/profile.module.ngfactory.js (webpack://app/./dist/site-server/main.js?:64670:87)
    at __webpack_require__ (webpack://app/./dist/site-server/main.js?:20:30)
    at Module../src/main.server.ts (webpack://app/./dist/site-server/main.js?:70988:108)

need to reproduce

Most helpful comment

i confirm it is working with version 2.2.3 and angular universal.

please fix it in the future versions

All 9 comments

Please provide instructions on how I should reproduce this.

I think it was a version mix up! Disregard it.

@ericel I get same issue. how you fix this?

I should reopen the issue! I actually had to revert to an older version to
be able to build universal!

On Wed, 24 Apr 2019 at 3:31 AM tuanuvt001 notifications@github.com wrote:

@ericel https://github.com/ericel I get same issue. how you fix this?

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/valor-software/ng2-charts/issues/1099#issuecomment-485922327,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEAVD2LIGZU2HW5OGO76W63PR5IZNANCNFSM4HHLEORA
.

I should reopen the issue! I actually had to revert to an older version to be able to build universal!
…
On Wed, 24 Apr 2019 at 3:31 AM tuanuvt001 @.*> wrote: @ericel https://github.com/ericel I get same issue. how you fix this? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1099 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAVD2LIGZU2HW5OGO76W63PR5IZNANCNFSM4HHLEORA .

which version works with universal ?

@almgwary "ng2-charts": "^1.6.0",

version 2.2.3 should run in universal fine, please check

i confirm it is working with version 2.2.3 and angular universal.

please fix it in the future versions

It's not working with ng2-charts 2.3.0. Please fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteeledSlagle13 picture SteeledSlagle13  Â·  3Comments

RKornu picture RKornu  Â·  3Comments

dj-techs picture dj-techs  Â·  3Comments

mrpotato3 picture mrpotato3  Â·  5Comments

shenriksen4 picture shenriksen4  Â·  3Comments