Rails Webpacker or Vue-CLI?

I am creating a single page (web application). I am very impressed with Rails v5.0, especially its built-in API capabilities.

In the past, I used JavaScript interfaces, using Vue.js, usually with templates provided Vue-CLI project. This allows you to deploy static sites Vue component-basedmainly anywhere. It's great.

Now Rails 5.1has built-in Webpack and Yarn features that also look pretty attractive. I am not sure how to continue working with my new application.

My questions:

  • What are the advantages / disadvantages of integrating Webpack and Vue into Rails using the Webpacker extensions available in Rails v5.1? I intend to deploy to Heroka.
  • On the other hand, what are the pros and cons of using the Rails API-only mode for the backend and supporting the Vue / Webpack interface in your own directory? I would save everything in the same repository, backend deployment via Heroku and interface using a static host like Netlify.
  • Which approach will have more cognitive service or technical challenges?

Over the past few days, I looked around, and I did not find much brief information on the Internet about this. People seem to be interested in the automatic reload features of the Rails development environment, but I get this for free already with Vue-CLI.

As far as I can tell, these are the reasons for their separate:

  • Deploying the interface is very easy anywhere.
  • Webpacker Rails , , . - , .

:

  • , , , .
  • "Rails-" Rails.
  • JS Frontend .
  • CORS (?)

?

+4
1

, -, , "". , . Webpacker ( node) , . .

vue cdn. :

  • dev/production

. haml, ruby2js, javascript . , , ruby, ruby ​​ , js, .

, - "vue annoted". . . x-template.

, : to_json, . . , . to_json , rabl, , .

, . vue-rails, . ( , )

+2

Source: https://habr.com/ru/post/1691240/


All Articles