Native apps with Vue.js: Weex or NativeScript? — chapter I

Written by tiagoreisalves | Published 2017/06/24
Tech Story Tags: vuejs | weex | nativescript | javascript | native

TLDRvia the TL;DR App

UPDATE 07-03-2018: Now there is a chapter II of this article! Make sure you check it out after reading this one.

Vue.js is a great framework! It has a friendly learning curve and combines the best of React’s component approach and Angular’s templates. Despite all this, Vue.js still has a limitation that could be a deal breaker: unlike with React’s React Native, Vue.js currently has no stable, widely adopted way to develop native apps.

This is bound to change, though! There are currently two frameworks under development that could open the door to creating native apps with Vue.js, the framework we all love and cherish: Weex and NativeScript. In this article we will compare both frameworks and give you enough of a taste to at least try one of them!

Weex

Weex is a project created by the chinese e-commerce giant Alibaba. Its slogan is "Write once, run Everywhere", meaning that you can produce builds for web (html5), Android and iOS from the exact same codebase. There are several Weex projects currently in production, in the hands of probably millions of users in China. The core of Weex is in active development with PRs coming every week. Weex has several components, plugins to interact with the native platform, and a set of tools that are still somewhat crude.

Unfortunately, Weex developers don’t see making the platform available for the open source community as a big priority. Sure you have documentation, github repos, etc., and some things are getting better now that Weex is under the Apache Incubator (ASF). But… there is still no clear way to build a Weex project from scratch without a considerable amount of hacking on the native code. Also, forget talking in English in the official gitter channel

NativeScript

In April, Igor Randjelovic opened up the possibility to use Vue with NativeScript. [nativescript-vue](https://github.com/rigor789/nativescript-vue) is a NativeScript plugin that bridges the gap between Vue.js virtual DOM and NativeScript components, allowing you to build cross-platform apps with Vue.js. Although the project is still in early stages and not suitable for production apps, it has lots of potential because it leverages the NativeScript framework with all of its tools and huge inventory of components and plugins. With webpack, you can even use .vue single file components (see this template).

The community is great and very well tendered! If you join the official slack you will find lots of friendly people willing to help, including NativeScript core team developers, nativescript-vue creator, and other folks involved on the project. There are lots of people wanting nativescript-vue to work!

Summary of Pros and Cons

Summing up the pros and cons of each framework, we have:

Weex :

👍 In production (although, only in China);👍 Builds for Web, Android and iOS;👎 Bad community;👎 Crude tools;👎 No clear path to start a project;

nativescript-vue:

👍 Awesome community!👍 Leverages all of NativeScript platform;👎 Not ready for production;👎 Builds only for Android and iOS (although there are people working on code sharing with a web build);

Final verdict

In open source projects, community trumps technology. Weex had a several months head start and is backed by a huge company, but we haven’t seen much progress in the community side of things. On the other hand, NativeScript + Vue has been getting an increasing amount of traction. Sure, there are some rough edges, but once they are cleared out we will have a solid framework to develop native apps with Vue.js.

I am betting on NativeScript!

NEXT:>>>> Go to chapter II.

Links

Weex:

NativeScript + Vue.js:

Hmm… how do you know all this stuff?

I have been playing with Weex for a while. I made tests, built a demo app, a walkthrough video, wrote articles, and presented about Weex in local events. Then, I boarded the nativescript-vue train! I wrote a silly app, won a contest and built a couple of templates to smooth the getting started process.


Published by HackerNoon on 2017/06/24