ofrohn / d3-celestial

A star map with d3.js
BSD 3-Clause "New" or "Revised" License
631 stars 179 forks source link

d3 is not defined #134

Open AleksandarCila opened 2 years ago

AleksandarCila commented 2 years ago

Hi @ofrohn ,

I have installed d3-celestial with npm i d3-celestial. I am using React. Imported everything in my component, but whatever I tried I get the same error: d3 is not defined.

It shows on celestial.js , row 1006: var d3js = require('./lib/d3.js'), d3_geo_projection = require('./lib/d3.geo.projection.js');

and later in d3.geo.projection.js wherever you use d3, for an example row 2: d3.geo.project = function(object, projection) {

VSCode says, on require('./lib/d3.js'): Could not find a declaration file for module './lib/d3.js' . [path_name] implicitly has an 'any' type.

I am not that experienced with those things, but what could be the problem of this?

Let me know if I need to share any additional info and thanks a lot for any kind of feedback!

johnvanhulsen commented 1 year ago

@AleksandarCila did you fixed it? I've got the same error from Svelte...

FilipLjubic commented 1 year ago

yep, same. If you guys get any updates on this please let me know

johnvanhulsen commented 1 year ago

@FilipLjubic I've used this fork: https://github.com/ownego/d3-celestial that fixed a lot of issues. I've build it local and load it into my HTML like this;

<script src="/src/d3.js"></script>
<script src="/src/d3.geo.projection.js"></script>
<script src="/src/celestial.js"></script>
FilipLjubic commented 1 year ago

thanks very much, I'll give it a try and let you know how it goes!