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
I'm trying to run some existing code on Nashorn instead of Rhino by using mod-lang-nashorn.
The code uses CommonJS to "require" some external libraries, such as URI.js
With the Rhino module everything works, but with the Nashorn module I get the following error:
javax.script.ScriptException: TypeError: Cannot read property "punycode" from undefined in <eval> at line number 27
FYI: punycode is another library, that is being "required" by the URI.js library.
First I thought it was an issue with the URI.js library and created a ticket for it at the URI.js github site.
But they explained (and convinced) me that the issues are caused by some bugs in the Vert.x Nashorn module and not in the URI.js library.
The error above can easily be solved by changing line 60 in VertxRequire from this:
This simple change fixes the error mentioned above.
Unfortunately there is one other bug, namely that the modules "required" by a CommonJS module are loaded from a wrong location.
E.g. URI.js loads several other libraries, like this:
I'm trying to run some existing code on Nashorn instead of Rhino by using mod-lang-nashorn.
The code uses CommonJS to "require" some external libraries, such as URI.js
With the Rhino module everything works, but with the Nashorn module I get the following error:
FYI: punycode is another library, that is being "required" by the URI.js library.
First I thought it was an issue with the URI.js library and created a ticket for it at the URI.js github site.
But they explained (and convinced) me that the issues are caused by some bugs in the Vert.x Nashorn module and not in the URI.js library.
The error above can easily be solved by changing line 60 in VertxRequire from this:
to this:
This simple change fixes the error mentioned above.
Unfortunately there is one other bug, namely that the modules "required" by a CommonJS module are loaded from a wrong location.
E.g. URI.js loads several other libraries, like this:
When I try to load URI.js (and therefore also those other libraries) with following code:
I get the following error:
In other words, the Nashorn module is trying to load those modules from the wrong location.
So to summarize, there are 2 issues with the CommonJS support in mod-lang-nashorn:
sANTo
The text was updated successfully, but these errors were encountered: