You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...vertx-lang-js throws with: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/Fuzz/tmp/vertx-js-demo/node_modules/web3/node_modules/bignumber.js (Is a directory)
Detail
What's interesting is that web3 itself has embedded its dependencies as a full copy within its distribution.
This seems to almost work with vertx-lang-js, failing only because it interprets a path ending with .js as being a javascript file (quite reasonably, but not the way node.js is resolving it, it seems).
So, looking at vertx-lang-js, I found the following in jvm-npm.js
Require.resolve = function (id, modParent) {
var roots = findRoots(modParent);
for (var i = 0; i < roots.length; ++i) {
var root = roots[i];
var result = resolveClasspathModule(id, root) ||
resolveAsFile(id, root, '.js') ||
resolveAsFile(id, root, '.json') ||
resolveAsDirectory(id, root) ||
resolveAsNodeModule(id, root);
if (result) {
return result;
}
}
return false;
};
In contrast, node appears to prefer module and directory resolution before file resolution.
regards
Fuzz.
The text was updated successfully, but these errors were encountered:
This is more tricky than just re-order the loaders, since most usages of vertx will be a fatjar and therefore modules will be loaded from the classpath. the issue here is that the classloader will return a valid reference to a directory and since it is just a input stream it will not be easy to identify if this should be a module or not...
this has been fixed on https://github.com/reactiverse/es4x back porting is not possible just because it would introduce behavior changes to the loader. The current loader is not fully compatible with commonjs, while the fixed one is and that's why it can make the distinction between files and directories.
Hello
This may be a bug with vertx-lang-js.
Reproducer
In a new directory:
in a test javascript file, try:
Summary
It appears that relatively common npm modules have a .js suffix in their module name (!)
e.g.
bignumber.js
I wouldn't normally want to use the above module, except that other modules, that I do want to use, require it
e.g. ethereum
web3
Hence, given ...
var Web3 = require('web3')
...vertx-lang-js throws with:
java.lang.RuntimeException: java.io.FileNotFoundException: /Users/Fuzz/tmp/vertx-js-demo/node_modules/web3/node_modules/bignumber.js (Is a directory)
Detail
What's interesting is that
web3
itself has embedded its dependencies as a full copy within its distribution.This seems to almost work with
vertx-lang-js
, failing only because it interprets a path ending with.js
as being a javascript file (quite reasonably, but not the way node.js is resolving it, it seems).So, looking at vertx-lang-js, I found the following in
jvm-npm.js
In contrast, node appears to prefer module and directory resolution before file resolution.
regards
Fuzz.
The text was updated successfully, but these errors were encountered: