Skip to content
On this page

Vue 3 源码设计解析

在本小节中,我们需要做两件事:

  1. 下载 vue 源码 版本3.2.37
  2. 了解 vue 源码基本结构

源码地址:https://github.com/vuejs/core/tags

  • 下载,自行下载就行

  • 基本结构:

    • 核心代码存放处:packages
    • 非常多的配置文件

啊,没错,知道打开packages,这就是我们这小节的目的!

打开 packages 我们继续了解:

  • compiler-core:编译器核心代码

  • compiler-dom:浏览器相关编译模块

  • compiler-sfc:单文件组件(.vue)编译模块

  • compiler-ssr:服务端渲染编译模块

  • reactivity:响应式核心模块

  • reactivity-transform:已经过期

  • runtime-core:运行时核心代码

  • runtime-dom:基于浏览器的运行时

  • runtime-test:测试用

  • server-renderer:服务端渲染

  • sfc-playground:sfc工具

  • shared:共享的工具

  • size-check:运行时包大小

  • template-explorer:线上测试

  • vue:测试实例,打包后的dist,一些入口方法等

  • vue-compat:用于vue2兼容性代码

加粗的是比较重要的!!!

Released under the MIT License.