第三方模块的查找机制是
例如,我需要查找 art-template
模块,这个模块已经被我安装到了项目中的node_modules
中,
- 先去
node_modules
中找到 art-template
文件夹 - 在
art-template
文件就按中找到packge.json
packge.json
文件中找到main.js
属性- 通过
main.js
属性值找到找到具体的.js
文件指向 - 执行指向的
.js
文件
注意
如果main属性值没有指向 则通过备用选项 index.js
执行index.js