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.


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

链接地址: http://www.djcxy.com/p/96052.html

上一篇: Flask SQLAlchemy数据映射器与活动记录模式

下一篇: 需要其他模块的包