Open devMagno opened 1 year ago
@devMagno you can check how it’s use for CRA here https://github.com/javascriptdata/Data-aRT
Thanks! It worked for me, but I would really like to use Danfo for Vite :(
Same here - rolled back to 1.1.1 - unfortunately that means I can't use parsing options in readExcel.... Haven't found a way to fix - tried the absolute path, tried changing entry point, like https://github.com/javascriptdata/danfojs/pull/516
Unfortunately still breaks in Vite.
Similar to issue #527
Also take a look at #514
Found a workaround on this thread: Discussions 525
Aside from the workaround on the https://github.com/javascriptdata/danfojs/discussions/525, I tried the https://github.com/javascriptdata/danfojs/pull/447 PR locally and it worked on Vite + React.
Repro steps:
yarn
and yarn build
src/danfojs-browser/lib
, the esbuild version (bundle.esm.js) and webpack version (bundle-esm.js)How I used the esbuild bundle version in my app:
import { Button, Text } from '@mantine/core';
import * as dfd from '../../../danfo2/bundle.esm.js'; // place the file somewhere, in this case in my src dir
export default function Create() {
async function load_process_data() {
let df = await dfd.readCSV('/titanic.csv');
console.log(df.head().print());
console.log(df.ctypes.print());
const title = df['Name'].apply((x: string) => { return x.split(".")[0] }).values
df.addColumn("Name", title, {inplace: true});
console.log(df.head().print());
}
return (
<div>
<Text>Create</Text>
<Button onClick={load_process_data}>Load Data</Button>
</div>
);
}
So based on these findings, we have to options.
<script>
tagBased on my node_modules
the bundle installed using npm install danfojs
is the webpack version and the esbuild version are not even included in the package. Also, the module
field in the package.json in the npm package is pointing to a wrong file, it should be lib/bundle.js
not lib/bundle-esm.js
Describe the bug I've installed danfojs@^1.1.2 in my React project using Vite and I'm getting the following error:
I really don't know what to do, I tried googling the error and found nothing. At first I thought it was a bug involving Vite, but then I tried using CRA and the bug still happens.
Screenshots