If X.json is a file
LOAD_AS_DIRECTORY
LOAD_AS_FILE(M)
require(X) from module at path Y
no
yes
let M = X + (json main field)
LOAD_INDEX(X)
If X.node is a file
If X.jx is a file
If X/index.json
If X begins with '/'
If X is a core module
return the core module
set Y to be the filesystem root
LOAD_AS_DIRECTORY(Y+x)
将x当做文件加载
not found
返回模块
THROW \"not found\"
If X begins with './' or '/' or '../'
LOAD_AS_FILE
If X/package.json is a file
If X is a file
主流程
将当前模块当做 文件夹处理
If X/index.node
从node_module中加载模块