It is possible to use node.js packages within Meteor as described here, however as require is not defined globally, packages having transitive dependencies (as for example xml2js or aws-lib) break with
ReferenceError: require is not defined
Any ideas on how to fix or work around this issue without altering the libraries?
I followed the instructions from your linked question. I used the node-xml2js library to test this with the test fixture from the code base and achieved it in the following way.
I think the key was to define a variable
requireand assign it to Meteor’s require function. When Meteor loads the server assets, it also loadsrequireand solves the problem of the transitive dependency. I made no changes to the node-xml2js library.Hope this helps!