Home  >  Article  >  You Yuxi’s latest announcement: Vue3 will become the default version!

You Yuxi’s latest announcement: Vue3 will become the default version!

藏色散人
藏色散人forward
2022-01-21 10:51:263330browse

Emphasis: Vue 3 will become the new default version on February 7, 2022!

Please be sure to read the Measures that may need to be taken section at the end of the article to confirm whether you need to make corresponding changes before switching to the default version to avoid exceptions.

This article is open to authorization and can be reproduced at will provided that the original address is indicated and the content is not modified.

From library to framework

In the beginning, Vue was just a runtime library. But over the years, it has gradually developed into a framework containing many sub-projects:

  • Core library, that is, the vue npm package

  • content Enough documentation to be a book Routing for page applications Vue Router

  • Vuex for state management

  • Browser developer tools extension for debugging and analysis

  • VSCode extension Vetur to support the development of single-file components

  • ESLint plug-in for static style/error checking

  • Vue Test Utils for component testing

  • Customized JSX Babel plugin that leverages Vue runtime capabilities

  • for VuePress generated by static website

  • It is precisely because Vue is a community-driven project that makes all this possible. Many of these projects were started by community members who later became members of the Vue team. The rest of the projects were originally started by me, but are now almost entirely maintained by the team, except for the core library. [Recommendation:

    vue.js video tutorial
  • ]
  • Vue 3’s “soft release”

As the core library releases a new major version, All other parts of the framework need to be updated simultaneously as well. We also need to provide an upgrade option for Vue 2 users. For a community-driven team like Vue, this is a huge undertaking. While the core library of Vue 3 is completed, other parts of the framework are either still in beta or have not yet begun to adapt to Vue 3. Our decision at that time was to release the core library first, so that early users could use it first, and developers of the library and upper-layer framework could adapt first, while we continued to update the rest of the framework. In this process, we still keep Vue 2 as the default version for documentation and npm installation. This is because we know that for most users, Vue 2 will still provide a more consistent and complete experience until the rest of Vue 3 is completed.

The brand new Vue

The "soft launch" process took longer than expected, but the moment has finally arrived: we are happy to announce that Vue 3 will be released in 2022 February 7th becomes the new default version.

In addition to the Vue core library, we have improved almost every aspect of the framework.

Extremely fast construction tool chain based on Vite

5101c0cdbdc49998c642c71f6b6410a8 brings a smoother development experience and combined API syntax

  • The single-file component TypeScript IDE provided by Volar supports the command line type checking and generation of single-file components provided by

  • vue-tsc

  • More concise state management provided by Pinia

  • New developer tool extension, supports Vue 2/Vue 3, and provides a plug-in system to allow community libraries to extend the developer tools panel themselves.

  • We also completely rewrote the main documentation. The new vuejs.org (currently pending release, Chinese translation is still in progress) will provide the latest framework overview and development suggestions, flexible learning paths for users from different backgrounds, throughout the guide and examples Switch between optional and composed APIs, and many new in-depth chapters. The site performance of the new documentation itself is also excellent – ​​we’ll explore this in detail in another blog post soon.

  • Version switching details
  • Here are the specific details of what we call the "new default version". In addition, be sure to read the Possible Actions section at the end of the article to confirm whether you need to make any changes before switching to the default version to avoid exceptions.

npm release tag

npm install vue will install Vue 3 by default.

The latest release tag of all other official npm packages will point to their Vue 3 compatible versions, including vue-router, vuex, vue-loader and @vue/test-utils.

  • Official documents and sites
  • All documents and official sites will be switched to the Vue 3 version by default. Includes:

    - http://vuejs.org
    - http://router.vuejs.org
    - http://vuex.vuejs.org
    - http://vue-test-utils.vuejs.org (将迁移到 http://test-utils.vuejs.org)
    - http://template-explorer.vuejs.org
  • Please note that the new http://vuejs.org will be a completely rewritten version, not the version currently deployed at v3.vuejs.org.

The current Vue 2 versions of these sites will be migrated to the new address (the version prefix indicates the respective version of the library, not the version of the Vue core library):

- http://vuejs.org -> http://v2.vuejs.org (旧的 v2 网址将自动重定向到新地址上)
- http://router.vuejs.org -> http://v3.router.vuejs.org
- http://vuex.vuejs.org -> http://v3.vuex.vuejs.org
- http://vue-test-utils.vuejs.org -> http://v1.test-utils.vuejs.org
- http://template-explorer.vuejs.org -> http://v2.template-explorer.vuejs.org

GitHub Repository

At the time of writing this article, warehouse-related changes have taken effect.

vuejs 组织下的所有 GitHub 仓库将把默认分支切换到 Vue 3 对应的版本。此外,以下仓库将被重命名,以删除其名称中的 next:

- vuejs/vue-next -> vuejs/core
- vuejs/vue-router-next -> vuejs/router
- vuejs/docs-next -> vuejs/docs
- vuejs/vue-test-utils-next -> vuejs/test-utils
- vuejs/jsx-next -> vuejs/babel-plugin-jsx

此外,主文档的翻译仓库将被移至 vuejs-translations 组织下。

GitHub 会自动处理仓库的重定向,所以之前的源码与 issue 问题的链接应该仍然有效。

开发者工具扩展

开发者工具 v6 目前是发布到 Chrome Web Store 的 beta 频道下的,在版本切换后,将移至稳定频道。

目前的稳定频道仍然可用。它将被迁移到遗留频道。

可能需要采取的措施

未指定版本的 CDN 链接

如果你通过 CDN 链接使用 Vue 2 而没有指定版本,请确保通过 @2 来指定一个版本范围:

- <script src="https://unpkg.com/vue"></script>
+ <script src="https://unpkg.com/vue@2"></script>
- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
+ <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>

注意:即使使用 Vue 3,你也应该始终在生产环境指定一个版本范围,以避免意外地加载到未来的大版本。

npm latest 标签

如果你使用 `latest` 标签或 `*` 来从 npm 安装 Vue 或其他官方库,请更新为明确使用兼容 Vue 2 的版本:

{
  "dependencies": {
-   "vue": "latest",
+   "vue": "^2.6.14",
-   "vue-router": "latest",
+   "vue-router": "^3.5.3",
-   "vuex": "latest"
+   "vuex": "^3.6.2"
  },
  "devDependencies": {
-   "vue-loader": "latest",
+   "vue-loader": "^15.9.8",
-   "@vue/test-utils": "latest"
+   "@vue/test-utils": "^1.3.0"
  }
}

原文地址:https://zhuanlan.zhihu.com/p/460055155

Statement:
This article is reproduced at:尤雨溪. If there is any infringement, please contact admin@php.cn delete