node 模块加载机制
转载自掘金网络,原文链接:https://juejin.im/post/5d84456851882556f33d5fb0
先执行一段代码a/index.js
1modulex.exports = 1;
useA.js
1234const a = require('./a');const express = require('express');console.log(module);console.log(global.require);
执行useA.js
12345678910111213141516171819202122Module
...