我如何需要一个依赖于另一个模块的模块?例如:
Project/foo.js
Project/nodule_modules/MyModule/node_modules/AnotherModule //dependencie of MyModule
Run Code Online (Sandbox Code Playgroud)
如何从 foo.js 文件中要求“AnotherModule”?
在模块中使用foo.js
:
var that = require('./node_modules/MyModule/node_modules/AnotherModule');
Run Code Online (Sandbox Code Playgroud)
请参阅http://nodejs.org/api/modules.html#modules_file_modules
归档时间: |
|
查看次数: |
7118 次 |
最近记录: |