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

Highcharts V12 compatibility #5

Open
rtrompier opened this issue Feb 13, 2025 · 1 comment
Open

Highcharts V12 compatibility #5

rtrompier opened this issue Feb 13, 2025 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@rtrompier
Copy link

Looks like the lib is not compatible with Highcharts v12.

[vite] (ssr) Error when evaluating SSR module /src/routes/+page.svelte: Cannot read properties of undefined (reading 'createEvent')
      at tt (/Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:9:2040)
      at setOptions (/Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:9:17013)
      at Object.compose (/Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:9:281239)
      at dQ.compose (/Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:9:291627)
      at /Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:9:374371
      at /Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:16:53
      at /Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:8:83
      at Object.<anonymous> (/Volumes/Data/workspace/huggingface/test/demo/node_modules/highcharts/highstock.js:8:329)
      at Module._compile (node:internal/modules/cjs/loader:155
@jszuminski
Copy link
Contributor

You're trying to use it in SvelteKit, not in Svelte. In SvelteKit there is no window object available at Highcharts evaluation time which will lead to errors. Either disable SSR and make the import only when your page is already in the browser (not on the server):

  import { browser } from '$app/environment';

  let clientLib;

  if (browser) {
    import('client-side-library').then((module) => {
      clientLib = module.default;
      // Use clientLib here.
    });
  }

@jszuminski jszuminski added the help wanted Extra attention is needed label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants