Gonzalo Bahamondez
Gonzalo Bahamondez

Reputation: 1371

require packages of other modules

Im writing some code in Node.js, using this library, https://github.com/dresende/node-orm2, this depends of other library https://github.com/felixge/node-mysql and one more time node-mysql depends of other https://github.com/felixge/node-require-all

On my app i want to use, the last module , node-require-all, outside of all of the libraries.

I know i can write the next code:

var reqall  = require("orm/node_modules/mysql/node_modules/require-all");

But im not sure if this is good.

should I add, the library in my project instead off this with?

npm install require-all?.

and later:

var reqall = require("require-all");

or is good use the first way?

thanks.

Upvotes: 2

Views: 99

Answers (1)

SheetJS
SheetJS

Reputation: 22925

It is best to directly add require-all to your dependencies in package.json.

In this case, according to node-mysql package.json, the require-all version will be 0.0.3. However, the latest version of require-all is 0.0.8, so if you want to use the latest version you have to specify it

Upvotes: 1

Related Questions