question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue importing @carbon/charts-svelte when using SvelteKit (possibly due to SSR)

See original GitHub issue

I am submitting a…

  • Feature request
  • Design defect
  • Source code defect
  • Demo/documentation defect
  • Other

charts version: 0.41.84

Issue description

Getting error this error when trying to import any type of chart into a SvelteKit page (.svelte file representing a route):

Importing binding name ‘default’ cannot be resolved by star export entries. moduleDeclarationInstantiation@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] link@[native code] linkAndEvaluateModule@[native code] [native code] promiseReactionJobWithoutPromise@[native code] promiseReactionJob@[native code]

The error occurs whether I use DonutChart in the template or not…

<svelte:head>
  <link rel="stylesheet" href="https://unpkg.com/@carbon/charts/styles.min.css" />
</svelte:head>

<script lang="ts">
  import { DonutChart } from '@carbon/charts-svelte'
</script>

<template>
  <DonutChart
        data={[
        {
          "group": "2V2N 9KYPM version 1",
          "value": 20000
        },
        {
          "group": "L22I P66EP L22I P66EP L22I P66EP",
          "value": 65000
        },
        {
          "group": "JQAI 2M4L1",
          "value": 75000
        },
        {
          "group": "J9DZ F37AP",
          "value": 1200
        },
        {
          "group": "YEL48 Q6XK YEL48",
          "value": 10000
        },
        {
          "group": "Misc",
          "value": 25000
        }
      ]}
        options={{
        "title": "Donut",
        "resizable": true,
        "donut": {
          "center": {
            "label": "Browsers"
          }
        },
        "height": "400px"
      }}
  />
</template>

Steps to produce the issue

  1. npm init svelte@next my-app (pick SvelteKit demo app, TypeScript)
  2. cd my-app
  3. npm install --saveDev @carbon/charts@0.41.84 @carbon/charts-svelte@0.41.84 d3@5.14.2
  4. Add import { DonutChart } from '@carbon/charts-svelte'; to the script tag in /src/routes/todos/index.svelte (note: not the script tag with context=“module”). Note: you don’t even have to have DonutChart in the template.
  5. npm run dev – --open
  6. Click TODOS at the top of the page

Current behavior

Error appears

Expected behavior

No error

Screenshot or recording

Following the steps will reproduce this issue

I suspect @carbon.charts may not be compatible with server-side rendering in its present state.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
nstuyvesantcommented, Jul 20, 2021

Confirmed on my end as well. Thanks for the amazingly fast response!

1reaction
metonymcommented, Jul 20, 2021

Upgrading to @carbon/charts version 0.41.86 fixes the SSR issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

carbon/charts-svelte
Start using @carbon/charts-svelte in your project by running `npm i ... vite.config.js import { sveltekit } from '@sveltejs/kit/vite'; ...
Read more >
Carbon Components with SvelteKit? : r/sveltejs
The component seems to "work" without error when I apply the changes to the svelte.config, but now the css styles don't seem to...
Read more >
Docs • Svelte
Complete documentation for Svelte.
Read more >
Top 23 TypeScript Svelte Projects (Oct 2022)
Which are best open-source Svelte projects in TypeScript? This list will help you: ✓storybook, ✓NativeScript, ✓mitosis, ✓windicss, ✓tsparticles, ...
Read more >
Newest 'svelte' Questions - Page 20
i'm using vercel + svelte kit to learn, and i have a problem after deploying when i go to my ... Import external...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found