节点模块依赖性 [英] Node module dependency

查看:71
本文介绍了节点模块依赖性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Nodejs和javascript的新手,还不确定如何提出正确的问题.我的主文件有一个var express = require('express');在它的上面.我还在我的主文件中创建一个需要的模块.我知道该模块也需要Express模块​​.我是否需要将express模块​​导入其中,否则主文件将解决这个问题?

I am new to Nodejs and javascript and not sure yet how to ask the right question. My main file has a var express = require('express'); on top of it. I am also creating a module that I will be requiring in my main file. I know that module also require the express module. Do I have to import the express module into it or the main file will take care of that?

推荐答案

模块完全独立.每个模块都必须导入所需的依赖项.

Modules are completely self contained. Every module has to import the dependencies it needs.

这篇关于节点模块依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆