danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Add Deno Support

Open dcrescim opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. Hey folks. I'm starting to do some ML with Deno, and I think it would be a good idea to build a ESM version of this library that is easily consumable from the Deno / browser. Basically I want to write import / export code that will work in either environment (Browser / Deno). I basically want to write the code below.

Deno

import * as dfd from 'https://cdn.skypack.dev/danfojs'
console.log(dfd)

Browser

<script type="module">
import * as dfd from 'https://cdn.skypack.dev/danfojs'
console.log(dfd)
</script>

Unfortunately skypack can't build danfojs right now (I haven't looked into why exactly), but I think we can easily update our build script to create a single ESM file and distribute it in the same way we distribute our ES5 bundle at

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/bundle.js"></script>

Solution

If you guys like the idea, I'd be happy to submit a PR that updates the build script to build a single ESM module that will allow for the code above.

dcrescim avatar Apr 17 '22 23:04 dcrescim

@dcrescim that sounds cool

steveoni avatar Apr 29 '22 10:04 steveoni

@steveoni Awesome, I just submitted a PR for an ESM bundle that would allow us to be used in Deno / more easily in browsers. It's here https://github.com/javascriptdata/danfojs/pull/447. Lemme know if this makes sense to you.

dcrescim avatar Apr 29 '22 17:04 dcrescim

I'm trying to use danfo with Deno for ML as well and came across this thread, love the idea! Unfortunately it looks like the skypack dist isn't building anymore: https://cdn.skypack.dev/danfojs. I'm not familiar with building ESM bundles (at the moment) so if anyone has any ideas, I'm all ears.

troyshu avatar Dec 31 '22 20:12 troyshu

the ESM Bundle is not working in deno as it requires document, which is not defined. it is used by the download functions and also by some plotcss code

mknj avatar Sep 30 '23 10:09 mknj