vasturiano / globe.gl

UI component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/globe.gl/example/world-population/
MIT License
1.97k stars 293 forks source link

Globe.gl + Svelte (Cannot set properties of null (setting 'innerHTML')) #139

Open th3d4v1d opened 1 year ago

th3d4v1d commented 1 year ago

Describe the bug Trying to render a simple globe using Svelte. Code below:

`

import Globe from 'globe.gl'

const container = document.getElementById('globeViz') as HTMLElement;

Globe()(container);

`

What am I missing? Running on Chrome, I get this error in the console:

globe.gl.module.js:478 Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') at Function.init16 (globe.gl.module.js:478:13) at initStatic2 (kapsule.module.js:139:14) at comp (kapsule.module.js:133:7) at instance (App.svelte:9:3) at init (index.mjs:1997:11) at new App (App.svelte:9:89) at createProxiedComponent (svelte-hooks.js?v=711e1c0b:341:9) at new ProxyComponent (proxy.js?v=711e1c0b:242:7) at new Proxy (proxy.js?v=711e1c0b:349:11) at main.js?t=1669912803246:4:13

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: Version 108.0.5359.72 (Official Build) (64-bit)
vasturiano commented 1 year ago

@th3d4v1d it looks like your container variable is set to null. Are you certain there is an element with id globeViz in your page?

If you're still having issues, please create an online example at https://codepen.io/ so we can have a closer look.