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

NPM modules via URL #187

Closed
SevereOverfl0w opened this issue Aug 19, 2016 · 2 comments
Closed

NPM modules via URL #187

SevereOverfl0w opened this issue Aug 19, 2016 · 2 comments
Labels

Comments

@SevereOverfl0w
Copy link

I'm trying to use some NPM modules in my code. I want to use webjars as the source of those modules, so that users of the software do not need to have npm installed.

Is it possible to refer to modules on the classpath in some way for nodejs.require()?

@midzelis
Copy link

midzelis commented Aug 27, 2016

Yes - I was able to do this. I needed to redefine fs.readFile* an fs.exists*. That almost did it, but node.js's module.js loader doesn't actually use fs.exists* for performance reasons. I couldn't redefine the native stat() function it used, so I had to go one layer up. I redefined module._findPath, which needed to bring with it a pretty significant portion of the module loader code unfortunately.

And it works! Needless to say, this is highly implementation dependent. As node changes, this could/will break.

A nice feature request would be have J2V8 expose all file operations (native and not) as java callbacks.

@irbull irbull added the nodejs label Jan 11, 2019
@irbull
Copy link
Member

irbull commented Jan 11, 2019

Unfortunately I need to reduce the scope of this project. I haven't been maintaining NodeJS support with J2V8 for a while now, and I think it's better to be honest about that then to just leave these bugs here. Please see #441 for more information.

If someone would like to create a downstream project that provides the Node bindings, I would support that and be happy to help them get started. I'm Labeling the NodeJS related bugs so we can move them to a downstream project if someone does setup such a project.

Again, sorry for the disappointment, but I think it's better to set honest expectations.

@irbull irbull closed this as completed Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants