文件結(jié)構(gòu)梳理
整體目錄
benchmarks\ 測(cè)試目錄
dist\ 構(gòu)建目錄
examples\ demo目錄
flow\
packages\
scripts\
src\ 核心源碼
test\ 測(cè)試目錄
types\
源代碼實(shí)現(xiàn)目錄
complier\ 模版編譯實(shí)現(xiàn)
core\ 核心
platforms\ 渲染平臺(tái)實(shí)現(xiàn)
server\ 服務(wù)器渲染實(shí)現(xiàn)
sfc\
shared\ 基礎(chǔ)工具目錄
模塊組織(vue\script\alias)
const path = require('path')
const resolve = p => path.resolve(__dirname, '../', p)
module.exports = {
vue: resolve('src/platforms/web/entry-runtime-with-compiler'),
compiler: resolve('src/compiler'),
core: resolve('src/core'),
shared: resolve('src/shared'),
web: resolve('src/platforms/web'),
weex: resolve('src/platforms/weex'),
server: resolve('src/server'),
entries: resolve('src/entries'),
sfc: resolve('src/sfc')
}
ps:給文件夾定義別名洪灯,方便編碼
path.resolve()方法將一系列路徑或路徑段解析為絕對(duì)路徑。