Open spaulg opened 9 years ago
Thanks for writing.
There is also a Google Group called "trireme-js" -- I thought that I put it on the README in GitHub but I missed it. It's a great place to discuss stuff like this.
https://groups.google.com/forum/#!forum/trireme-js
As for your specific question:
Trireme doesn't do anything different in "require" than any regular Node deployment. Because it uses the same "module" module as regular Node, it reads the files directly from the disk. If you can get your installation to write the node_modules directory on the disk in the right place, then you can configure Trireme to find it there just like you do in regular node, by setting the NODE_PATH environment variable, as described below:
https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
does that help?
On Mon, May 4, 2015 at 4:36 AM, Simon Paulger notifications@github.com wrote:
Hi,
First off, apologies if this is not the appropriate forum to raise support requests. I was unable to find a better alternative to request help in using trireme.
I've been building a ReactJS JSX transformer maven plugin. Initially it is simply executed the jsx binary using node but I'd like to implement it without requiring node. To do this, I have used trireme to implement node.
I have come across an implementation problem however - if I use npm to install the react-tools in node and copy these in to my Java resources path, all dependencies are nested under the react-tools/node_modules path. Embedding this version in my maven plugin works with trireme. npm-maven-plugin however downloads all dependencies in to a single flat node_modules path, which then doesn't work due to missing dependencies upon execution.
I think what is happening (though I don't know for sure) is that trireme cannot find the dependencies when require() is called. Is there a way to set a base module load path when require() is called within the module JS?
Regards, Simon
— Reply to this email directly or view it on GitHub https://github.com/apigee/trireme/issues/113.
greg brail | apigee https://apigee.com/ | twitter @gbrail http://twitter.com/gbrail
Hi Greg,
Thanks for getting back to me. Unfortunately setting the NODE_PATH environment variable didn't resolve my problem.
I'm going to look in to whether the npm-maven-plugin can be made to create the correct node_modules folder hierarchy when it pulls in dependencies.
Alternatively, I might just stick with the module layout as downloaded by npm itself as a manual step to complete when building my plugin.
Thanks, Simon
Hi,
First off, apologies if this is not the appropriate forum to raise support requests. I was unable to find a better alternative to request help in using trireme.
I've been building a ReactJS JSX transformer maven plugin. Initially it is simply executed the jsx binary using node but I'd like to implement it without requiring node. To do this, I have used trireme to implement node.
I have come across an implementation problem however - if I use npm to install the react-tools in node and copy these in to my Java resources path, all dependencies are nested under the react-tools/node_modules path. Embedding this version in my maven plugin works with trireme. npm-maven-plugin however downloads all dependencies in to a single flat node_modules path, which then doesn't work due to missing dependencies upon execution.
I think what is happening (though I don't know for sure) is that trireme cannot find the dependencies when require() is called. Is there a way to set a base module load path when require() is called within the module JS?
Regards, Simon