译Vue-32020年中状态更新

1次阅读

共计 3813 个字符,预计需要花费 10 分钟才能阅读完成。

前言

之前我翻译的 [[译] 尤雨溪:Vue3 的设计过程](https://juejin.im/post/5ecf58…:尤雨溪希望能在 2020 年的上半年发布 Vue3.0,但眼看这都七月份了,2020 年已经过半,许多人都跑去 vue 的 issue 问现在到底怎么回事了,是不是心思全放在开发 vite 上了?

对此,尤雨溪在 vuejs/rfc 里面开了个 issue,特意来说明了 vue 现在的情况:

链接:https://github.com/vuejs/rfcs/issues/183

译文

我们的许多用户都在问这个问题:Vue 3 到底何时才能准备就绪?我们无法给出确切的答案,因为预估软件的交付时间本来就是不准确的。作为一个非营利性项目,我们希望专注于编写优秀的软件,而不是按时赶工期。但这确实是一个漫长的等待,而且我们知道这些不确定性会导致计划使用 Vue 3 的项目变得困难。所以我们想提供一些指导和详细的状态更新,以帮助我们的用户相应地调整他们的期望和计划。

在 Vue 3 上花费的大部分时间都花在了设计和构建内核上,这带来了许多令人兴奋的改进。但是,为了将整个框架标记为“已就绪”,它不仅仅涉及到 Vue 的核心部分。我们还需要具有兼容版本的支持库 (Vue Router,Vuex,test utils),工具(CLI,eslint 插件,浏览器 devtool 扩展,IDE 扩展) 和文档(适用于新用户和老用户迁移)。尽管我们一直在努力开发所有这些部分,但要使所有个各部分全都组合在一起需要付出大量的努力和协调,因此很难准确的预测时间表。我们最初希望在 2020 年上半年发布 Vue 3,但考虑到目前的进展,我们必须重新对其进行调整。我们当前的目标是 7 月中旬发布 RC 版(候选版本),8 月初发布 3.0 正式版。

决策树

但是,这并不意味着您不能现在就开始使用 Vue 3。现在,大多数框架部分都处于 beta 或 alpha 状态,而 vue 的核心版本已经由我们的最初使用者进行了广泛的测试。阻止我们进入 RC 的唯一原因是浏览器 devtools 扩展(目前正在积极开发中)。所有重要的更改都已写在 RFC 中了,并且我们没有要重大更改的计划。如果您一直在等待使用 Vue 3,以下是决策树,可帮助您进行相应的计划:

IWantVue3()

async function IWantVue3() {await read(`https://github.com/vuejs/rfcs/pulls?q=is%3Apr+is%3Amerged+label%3Acore+-label%3Arevoked+-label%3A2.6+sort%3Acomments-desc`)

  if (isTrue("I just want to play with Vue 3"))) {
    // If you just want to try Vue 3 out - you can do it right now with Vite.
    // Vite (https://github.com/vitejs/vite) is a new dev/build tool that we
    // created that is lighter, faster and produces smaller bundles. It works
    // with Vue 3 out of the box.
    run(`npm init vite-app hello-vue3`)
    return
  }

  if (isTrue("I am planning to use Vue 3 for a new project")) {if (isTrue("I need IE11 support")) {await IE11CompatBuild() // July 2020
    }
    if (isTrue("RFCs are too dense, I need an easy-to-read guide")) {await migrationGuide() // July 2020
    }
    if (isTrue("I'd rather wait until it's really ready") {await finalRelease() // Targeting early August 2020
    })
    run(`npm init vite-app hello-vue3`)
    return
  }

  if (isTrue("I am planning to upgrade an existing Vue 2 project")) {await IE11CompatBuild()
    await migrationGuide()
    await ecosystem(
      // this is the tricky part: if you have an existing, non-trivial Vue 2
      // app, you likely are using some dependencies that are not yet
      // Vue-3-compatible, for example meta frameworks like Nuxt, or UI
      // component libraries like Vuetify. If that's the case, our suggestion
      // is don't be in a hurry to upgrade. It *will* take some time for the
      // ecosystem to catch up.
      // Also note that you can start using Vue Composition API in Vue 2 today
      // via https://github.com/vuejs/composition-api - we are also going to be
      // backporting compatible Vue 3 features to 2.x once 3.0 is out.
    )
    return
  }

  if (isTrue("I am the author of a Vue ecosystem library")) {
    // It's time to make your lib Vue 3 compatible!
    return
  }
}

框架目前的状态

Vue 3 Core

  • 当前版本:v3.0.0-beta.18
  • GitHub 地址:https://github.com/vuejs/vue-next
  • RFC 地址:https://github.com/vuejs/rfcs/pulls?q=is%3Apr+is%3Amerged+label%3Acore

Vue 3 Core 已经处于测试阶段两个多月了。我们已经合并了所有计划中的重大更改 RFC,并且在正式 3.0 版本之前没有进一步的重大更改的计划。

成千上万的早期使用者已在新项目中使用过,并帮助我们修复了许多 bug 还帮我们发现了一些与 Vue 2 的不一致行为。在此阶段,我们认为 Vue 3 内核相当稳定,可以用于 RC。

Vue Router

  • 当前版本:v4.0.0-beta.1
  • GitHub 地址:https://github.com/vuejs/vue-router-next
  • RFC 地址:https://github.com/vuejs/rfcs/pulls?q=is%3Apr+is%3Amerged+label%3Arouter

4.0 版本的 router hooks 仍然存在一些轻微的与 vue-router 3.x 版本不一致行为,但这是唯一导致 Vue Router 标记为 Beta 的原因。该版本的 Vue Router 可用于非关键的新项目上。

Vuex

  • 当前版本:v4.0.0-beta.4
  • GitHub 地址:https://github.com/vuejs/vuex/tree/4.0

Vuex 4.0 和 3.x 之间的唯一区别是它兼容 Vue 3!并且已经准备与 Vue 3 一起进入 RC 阶段。

Vue CLI

当前可以通过 vue-cli-plugin-vue-next 来在 Vue CLI 中使用 Vue 3。您可以搭建一个新项目,然后运行 vue add vue-next 去切换到 Vue3。当达到 RC 时,Vue 3 将成为项目创建过程中的一个选项。

请注意,如果您不是特别需要 Webpack 和兼容 IE11,那么也可以使用 Vite 来启动 Vue 3 项目。

JSX 支持

当前有两种针对 Vue 3 的 JSX 转换实现,其语法略有不同(针对 Vue 的特定功能):

  • vueComponent/jsx
  • HcySunYang/vue-next-jsx

我们正在用这个 issue 来收集大家的意见以确保设计的统一,并制定一个 JSX 中应如何处理 Vue 功能的正式规范。如果您将 Vue 与 JSX 一起使用,请在该 issue 中提供您的反馈。

其他项目

项目名 状态
vue-devtools WIP(7 月上旬支持 Vue 3 beta)
eslint-plugin-vue v7.0.0-alpha.9 [[GitHub 地址]](https://github.com/vuejs/esli…
@vue/test-utils v2.0.0-alpha.7 [[GitHub 地址]](https://github.com/vuejs/vue-…
vue-class-component v8.0.0-alpha.6 [[GitHub 地址]](https://github.com/vuejs/vue-…
vue-loader v16.0.0-beta.4 [[GitHub 地址]](https://github.com/vuejs/vue-…
rollup-plugin-vue v6.0.0-beta.6 [[GitHub 地址]](https://github.com/vueCompone…
正文完
 0