Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/594 exports #604

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Conversation

ekynoxe
Copy link

@ekynoxe ekynoxe commented Oct 5, 2023

fixes #594 (and maybe also #545 and #527)

For a new vite app, a new CRA app and a new Vuew app, I've linked the package locally with npm link danfojs, then used the following code in the root file:

import * as dfd from 'danfojs'
const s = new dfd.Series([1, 3, 5, undefined, 6, 8])
s.print()

Both apps run fine without runtime errors and display the series in the console.

Screenshot 2023-10-05 at 12 55 36 Screenshot 2023-10-05 at 12 55 18 Screenshot 2023-10-09 at 09 31 54

However, types don't work, and I get the following error in CRA terminal output:

WARNING in ../danfojs/src/danfojs-browser/lib/bundle.esm.js 9:47-54
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ../danfojs/src/danfojs-browser/lib/bundle.esm.js 12:44-51
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I'm also new to package exports, so it's all a little blurry, but hopefully that's a start to fix the issues and could do with some help to finish it off.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project seems to be using yarn, so this file is unnecessary and was generating warnings running yarn

@@ -8,7 +8,14 @@
],
"scripts": {
"install": "cd src/danfojs-base && yarn && cd ../danfojs-browser && yarn && cd ../danfojs-node && yarn",
"build": "cd src/danfojs-node && yarn build:clean && cd ../danfojs-browser && yarn build:clean",
"test": "cd src/danfojs-base && yarn && cd ../danfojs-node && yarn && yarn test:clean && cd ../danfojs-browser && yarn && yarn test:clean"
"build": "yarn build:browser && yarn build:node",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from my other PR #603 so I could run build and tests independently from the root of the project

"module": "lib/bundle-esm.js",
"exports": {
".": {
"types": "./dist/danfojs-browser/src/index.d.ts",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really unsure about the correct syntax here.

@ekynoxe ekynoxe marked this pull request as ready for review October 5, 2023 15:00
@ekynoxe ekynoxe mentioned this pull request Oct 9, 2023
@adarshmadrecha
Copy link

This fix makes the package run on Vite. Pls merge this fix.

@EsbenCN
Copy link

EsbenCN commented Jan 30, 2024

@risenW @steveoni Any plans for merging this fix?

@lschierer
Copy link

I hit this today attempting to try out danfojs for the first time. Any plans to merge in the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't work with Vitejs
4 participants