-
Notifications
You must be signed in to change notification settings - Fork 859
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
[CommonJS] Support for loading (nodejs) packages #55
Comments
Loading packages currently isn't supported by Rhino's CommonJS module loader. Strictly speaking, package support is not part of the CommonJS module spec. I'll see if I can port the relevant bits from RingoJS to add package support to Rhino. |
For now I've extended the class UrlModuleSourceProvider and added the loading behavior without problem. My idea is reuse packages via npm parsing the package.json in a near future. BTW, Yesterday I tested part of the Jade template engine inside Google App Engine without major problems :D Thanks for your great work! |
I also got this working by extending Anyone who wants to fold my code into Rhino is welcome to do so! I'm sure there's room to improve it, since I hardly ever code in Java... |
As @hns mentioned, loading (nodejs) packages isn't part of the CommonJS specification and thus not part of Rhino's CommonJS implementation, thus I marked this as a Feature If packages support is required right now, either use https://github.com/micmath/Rhino-Require or fiddle with the (Url)ModuleSourceProvider as suggested in #55 (comment) to achieve the result you want. As (nodejs) package isn't standard CommonJS, I would not expect this to become part of the Rhino core, but maybe some add-on that can be pulled into your environment if needed Also tagged this with the |
Hello,
I'm trying to load a module's folder instead of a specific js file and I'm getting a error:
ReferenceError: "index" is not defined. (file:/****/modules/test#1).
The root of the modules is configured to be: file:/****/modules/
From a script (modules.js) I'm doing:
var test = require("test");
Where, test in a folder inside modules with an index.js file defining the module's startup.
Important:
My Findings:
Could someone give me a hand?
Thanks!
The text was updated successfully, but these errors were encountered: