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

Question/Requirement invoke jsdom/d3.js using es4x #565

Open
rzorzorzo opened this issue Dec 18, 2021 · 1 comment
Open

Question/Requirement invoke jsdom/d3.js using es4x #565

rzorzorzo opened this issue Dec 18, 2021 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@rzorzorzo
Copy link

Hello,
I have a vertx application (java) where I would like to use d3.js to generate server side svg charts.
I think that polyglot programming makes most sense if one can leverage, out of the box, existing libs.

I tested es4x for this. However this did not work as expected.
I am getting many errors such as "fs module not found" (or similar).
Here the js code:

jsdom = require('jsdom')
d3 = require('d3')

to reproduce create an npm project, then call "npm install --save jsdom d3"
create a file index.js with the above content.
invoke the index.js file with es4x.

I have been able to get this to run with j2v8 nodeJS implementation.
But, es4x would be a better fit for my application, as this would be a pure java application.

As a side note: with graalvm (using the experimental require feature) I am getting the similar errors as with es4x.

-- Ron

@pmlopes pmlopes self-assigned this Dec 19, 2021
@pmlopes
Copy link
Contributor

pmlopes commented Dec 19, 2021

Hi Ron,

In seems that d3 is trying to pull node specific modules, perhaps we need to tweak it to "think" it's running on a browser and it should work?

I think I need to prepare such a project and debug where it is calling the filesystem and see if we can avoid it.

@pmlopes pmlopes added the question Further information is requested label Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants