As Vue users, many of you may have used vue-resource for handling ajax requests in your Vue applications. For a long time it’s been thought of as the “official” ajax library for Vue, but today we are retiring it from official recommendation status.

Although listed under the vuejs organization, vue-resource was almost completely written and maintained by the PageKit team. We transferred it into the vuejs organization in the early days because it was great seeing the community contributing libraries solving an essential problem, and we greatly appreciate all the work the PageKit team has put into the project. However, over time we have come to the conclusion that an “official ajax library” is not really necessary for Vue because:

Unlike routing and state-management, ajax is not a problem domain that requires deep integration with Vue core. A pure 3rd-party solution can solve the problem equally well in most cases. There are great 3rd party ajax libraries that solve the same problem, are more actively improved/maintained, and designed to be universal/isomorphic (works in both Node and Browsers, which is important for Vue 2.0 with its server-side rendering usage). Given (1) and (2), it’s obvious that we are duplicating the effort and bringing in unnecessary maintenance burdens by keeping vue-resource’s current status. The time we spend on resolving vue-resource issues can be better spent improving other parts of the stack.

Q&A

Does this mean vue-resource is deprecated?

No. It’s just no longer part of the “official recommendation”. The repo will be moved back to pagekit/vue-resource, and will continue to work. It will be up to the PageKit team to decide the long term plan for the library.

Should I Stop Using It?

It’s totally fine to keep using it if you are happy with it. Potential reasons to migrate away include maintenance, universal/isomorphic support and more advanced features.

What Should I Use Then?

You are free to pick whatever you prefer (even just $.ajax ), but as a default recommendation — particularly for new users — we suggest taking a look at Axios. It’s currently one of the most popular HTTP client library and covers almost everything vue-resource provides with a very similar API. In addition, it is universal, supports cancellation, and has TypeScript definitions.

If you prefer something lower-level, you can simply use the standard fetch API. Take a look at isomorphic-fetch which is a polyfill that works in both browsers and Node.

Tips for Using Axios with Vue