if(package.json存在 && package.main字段存在 && package.main指定的js存在) {
取package.main指定的js作为from的来源,即使该js可能格式或内容错误
} else if(index.js存在){
取index.js作为from的来源
} else {
取index.vue作为from的来源
}
在 Vue Element Admin 源码中,可以看到 layout/index.vue 文件 import from './components'。
那我们会去 components 文件夹下寻找相关文件,其中发现存在 index.js 文件,