Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load Stock as a module: ERROR TypeError: this.Highcharts[(this.constructorType || "chart")] is not a function #316

Closed
raf18seb opened this issue Mar 10, 2022 · 6 comments

Comments

@raf18seb
Copy link

Is it related to this? #216

Describe the bug

As in the title.

Demo

https://stackblitz.com/edit/highcharts-angular-stock-bmcsle?file=src/app/app.component.ts

Workaround

Override Highcharts by Highcharts by Highcharts._modules['masters/highcharts.src.js']

export class AppComponent {
  Highcharts: typeof Highcharts = (Highcharts as any)._modules['masters/highcharts.src.js'];

or... load Stock directly, not as a module.

Version

Tested also with Highcharts v10.0.0 and highcharts-angular 3.0.0

@karolkolodziej
Copy link
Contributor

karolkolodziej commented Mar 14, 2022

It looks like some error specific to the stackblitz code editor.
I don't get that in codesandbox nor locally (demo app).

Adding the Stock module after importing the core of Highcharts is the correct way of doing it.

import * as Highcharts from 'highcharts';
import HC_Stock from 'highcharts/modules/stock';

HC_Stock(Highcharts);

PS. Please note that the isHighcharts flag should be only used on the server-side, not in the browser.

@karolkolodziej
Copy link
Contributor

However, if you are using it on the server-side instead of importing the whole Highcharts module like this
import * as Highcharts from 'highcharts';
please use
import Highcharts from 'highcharts';

Demo: https://stackblitz.com/edit/highcharts-angular-stock-9yx4iv

@karolkolodziej
Copy link
Contributor

Closed due to inactivity.

@karolkolodziej karolkolodziej closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2022
@ekkolon
Copy link

ekkolon commented Jan 9, 2024

However, if you are using it on the server-side instead of importing the whole Highcharts module like this import * as Highcharts from 'highcharts'; please use import Highcharts from 'highcharts';

Demo: https://stackblitz.com/edit/highcharts-angular-stock-9yx4iv

Can confirm on the latest Angular v17!

@borisdaev
Copy link

However, if you are using it on the server-side instead of importing the whole Highcharts module like this import * as Highcharts from 'highcharts'; please use import Highcharts from 'highcharts';
Demo: https://stackblitz.com/edit/highcharts-angular-stock-9yx4iv

Can confirm on the latest Angular v17!

I am facing this issue,

ERROR TypeError: Cannot read properties of undefined (reading 'Core/Globals.js')
at HC_Stock (c:/Users/User/source/jackpots-guru/frontend/node_modules/highcharts/modules/stock.js:9:539)
at eval (c:/Users/User/source/jackpots-guru/frontend/projects/jackpots-landing-page/src/app/components/line-chart/line-chart.component.ts:7:1)
at async instantiateModule (file:///C:/Users/User/source/jackpots-guru/frontend/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:50861:9)

can you please provide an example code that implements SSR in Angular version 17 using standalone components?

@karolkolodziej
Copy link
Contributor

see: #372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants