graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

Support for Node.js `http` and `fs` modules in GraalJS

Open wangxi761 opened this issue 1 year ago • 1 comments

I am reaching out to inquire about the support for Node.js core modules, particularly http and fs, within the GraalJS context. Many npm packages heavily rely on these core modules for various functionalities. However, when embedding GraalJS into a Java application using the Context API, we face limitations that prevent us from leveraging such packages.

Understanding that GraalVM aims to provide a high-performance runtime that supports various languages, the lack of support for these critical Node.js modules means that Java applications cannot fully utilize a vast ecosystem of JavaScript libraries and tools, which naturally limits the potential use cases and inter-operability options.

Are there any plans to add support for these core modules within GraalJS when used in a Java embedded context? If there are technical challenges or design decisions that prevent this support, could you share some insights on the underlying reasons or potential alternatives that you recommend?

wangxi761 avatar Apr 15 '24 02:04 wangxi761

That's unfortunately not supported, see:

https://github.com/oracle/graaljs/issues/2#issuecomment-385776163

But if you'd like to use arbitrary Node modules from Java, you may be interested in

https://mikehearn.github.io/nodejvm/

which is a set of utilities that work with GraalVM+Node to make that easier.

mikehearn avatar Apr 24 '24 13:04 mikehearn