Hacker News new | ask | show | jobs
by joshribakoff 3035 days ago
When you say JS hell I'm assuming you mean because Rails wants to be your JS bundler? Why not just have rails output a div with an ID? And then use a separate bundler such as webpack to generate a JS bundle?

At the end of the day Vue-cli or create-react-app ultimately just generates static assets. Adding your statically built SPA into a Rails app should be no harder than adding jQuery. Rails should not need to know about webpack & vice versa. The key is to build components not a full fledged SPA. Pick either Rails or Vue router. If the former, Vue is just a component/view library, don't treat it like a framework.

1 comments

Of course, Rails 5.1+ supports webpacker better too, which I believe is recommended/intended for use with stimulus+Rails too (to get the es6 in the example, for instance).