4 ms·
You want Webpack bundled with your backend framework? ...Why?
by aphextron 8y ago
You want Webpack bundled with your backend framework?
...Why?
- wgerard 8y agoAFAIK anyway, Webpack isn't automatically installed with every Rails app but is easily available via https://github.com/rails/webpacker https://github.com/rails/webpacker. So it's not "bundled" necessarily all the time, but is quite trivially added to a Rails project. If your question is more like "why the hell would you ever want to run Webpack and Rails simultaneously together": You will increasingly find tools you want to use that more-or-less require Webpack (or a similar JS build tool). Because of things like e.g. the asset pipeline, it's extremely frustrating trying to get those tools to work in concert with each other as micro-services that know nothing about each other. It's much easier to use something like Webpacker so they can play nicely with each other.
- kossae 8y agoI assume Rails in this case would be used in the “full stack” sense with an asset pipeline for frontends as well, instead of the Rails API-only mode.
- websitescenes 8y agoRails can be used without the asset pipeline and with Webpacker only. But yes, most likely you will not use API-only mode of using the asset pipeline or webpacker.
- aphextron 8y agoI get the idea, it just seems like a very "2013" way of doing web development. Things have moved on past the monolith for an endless amount of reasons.
- tekstar 8y agoendless amount of reasons, such as?
- websitescenes 8y agoI used to believe the same as you and wrote quite a few web apps with dedicated backends and frontends. The overhead and amount of redundancy doesn’t seem worth it to me anymore though and I’ve turned to hybrid apps. Development time has dramatically improved and I’ve lost literally nothing.
- websitescenes 8y agoIt’s a great approach for hybrid web apps. I didn’t want to go with a React only frontend where routing is controlled by react-router. I’ve opted instead to leave the routing to Turbolinks. This has a number of advantages. I get the benefits of an SPA while still being able to render server generated Rails views. This frees me up to use React only where it’s advantageous; like on real-time super dynamic views. I have multiple React entry points and the data is tied together by a shared Redux store. I’ll admit this was not trivial to setup but it’s been working great.