Vue 2.5 released

Evan You
Evan You
Oct 13, 2017 · 3 min read

We are excited to announce the release of Vue 2.5 Level E! This release includes improvements of various features and we recommend checking out the release note for full details. In this post we are going to highlight some of the more prominent changes: better TypeScript integration, better error handling, better support for functional components in single-file components, and environment-agnostic server-side rendering.

Better TypeScript Integration

With the help from the TypeScript team, 2.5 offers greatly improved type declarations that works with Vue’s out-of-the-box API without the need for a component class decorator. The new type declarations also power editor extensions like Vetur, enabling better Intellisense support for plain JavaScript users as well. For more details, checkout our earlier post regarding the changes.

Shoutout to Daniel Rosenwasser from the TypeScript team for starting the PR, and to core team members Herrington Darkholme and Katashin for improving and reviewing the changes.

Note: TypeScript users should also update the following packages to the latest version for type declaration compatibility: vue-router, vuex, vuex-router-sync and vue-class-component.

Better Error Handling

In 2.4 and earlier versions, we typical use the global config.errorHandler option for handling unexpected errors in our applications. We also have the renderError component option for handling errors in render functions. However, we lack a mechanism for handling generic errors inside a specific part of the application.

In 2.5 we have introduced the new errorCaptured hook. A component with this hook captures all errors (excluding those fired in async callbacks) from its child component tree (excluding itself). If you are familiar with React, this is similar to the concept of Error Boundaries introduced in React 16. The hook receives the same arguments as the global `errorHandler`, and you can leverage this hook to gracefully handle and display the error.

Better Support for Functional Components in SFCs

With vue-loader >= 13.3.0 and Vue 2.5, functional components defined as a Single-File Component in a *.vue file now enjoys proper template compilation, Scoped CSS and hot-reloading support. This makes it much easier to convert leaf-components into functional ones for performance optimizations.

Shoutout to core team member Blake Newman for his contribution to these features.

Environment Agnostic SSR

The default build of `vue-server-renderer` assumes a Node.js environment, which makes it unusable in alternative JavaScript runtimes such as php-v8js or Nashorn. In 2.5 we have shipped a build of vue-server-renderer that is environment-agnostic which can be used in the browser or in pure JavaScript engines. This could open up interesting strategies such as utilizing Vue server-rendering directly in your php process.

Again, we recommend checking out the full release note for improvements in other APIs, including v-on, v-model, scoped slots, provide/inject and more. You might also be interested in our public roadmap detailing what the team is working on. Cheers!

The Vue Point

The Official Vue.js Blog

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store