Gmousse / dataframe-js

No Maintenance Intended
https://gmousse.gitbooks.io/dataframe-js/
MIT License
460 stars 38 forks source link

Can't load dataframe.js #61

Closed nchabalier closed 6 years ago

nchabalier commented 6 years ago

Hello, I wan't to use the file dataframe.js in the dist folder but I have the following error: TypeError: DataFrame is not a constructor

My code is the following

DataFrame = require('./dataframe-js/dist/dataframe.js').DataFrame;
test = new DataFrame([]);
test.show();

(I have no problem if I replace the first line by this one: DataFrame = require('./dataframe-js/lib').DataFrame; but I need to install babel-runtime with npm.)

Do you know what is the problem ? Thanks

Gmousse commented 6 years ago

Hi @nichabalie,

Indeed the dist folder is currently used only into the browser (build with webpack). Like that, you can't use it in nodejs with a require.

If you want an easy way to work with dataframe-js (with its own dependencies), you can use npm install dataframe-js or even yarn install dataframe-js. It will install the library correctly. Then you can use the library with require('dataframe-js').DataFrame;

nchabalier commented 6 years ago

Thank you @Gmousse for your response, that resolved my problem. I don't know if it's normal but to make it works I had to use the command npm install babel-runtime too.

Gmousse commented 6 years ago

Hi @nichabalie, I have created #63 for your issue with babel-runtime. Thank you for using dataframe-js :D