vega / svelte-vega

Svelte component for Vega and Vega-Lite
BSD 3-Clause "New" or "Revised" License
72 stars 7 forks source link

Does not work with SvelteKit SSR #977

Open Sparkier opened 16 hours ago

Sparkier commented 16 hours ago

vega-embed depends on json-stringily-pretty-compact, but that does not work when SSR is enabled:

SyntaxError: Cannot use import statement outside a module

Disabling SSR via export const ssr = false; will fix things, but that is certainly not ideal.

domoritz commented 11 hours ago

Looks like we only use it for the "view source" in https://github.com/vega/vega-embed/blob/2dfdf591c86462077fc780dd717d40681ffed6aa/src/embed.ts#L4. It's a super simple library: https://github.com/lydell/json-stringify-pretty-compact/blob/main/index.js. Maybe if we update to v4, this issue goes away since that's esm?

Sparkier commented 11 hours ago

Could very well be. Are you planning to update vega-embed to v4? If so, I can test.

domoritz commented 11 hours ago

Done. Try 6.29.0.

Sparkier commented 10 hours ago

Still getting: Image

Not much more time to explore further today. Can look into it again later this week.

domoritz commented 10 hours ago

Thanks for trying and thanks for pushing me to finally update this dependency across our stack.