after rails new. • Provide javascript_pack_tag helper and others to link JavaScript assets • Quick start of React, Vue, Angular, Elm and Stimulus and others
is extra cost to learn if one knows webpack very well. • Update to webpack 4 is slow. ◦ It has finally been released recently though. • Better to discard webpacker when rails app is initialized. ◦ Is this only in Japan context?
Basically, not customizable • Provide eject feature • Some tools such as https://github.com/timarney/react-app-rewired enables us to overwrite config. It’s community based.
application • Customizable ◦ Using https://github.com/survivejs/webpack-merge • Does not provide eject feature ◦ More importantly, we want to encourage people to stay away from ejecting so that they get upgrade capabilities in the future. This is important from both a bug fix and security perspective. ▪ https://github.com/vuejs/vue-cli/issues/2796
is no best way neither framework nor build tool ◦ Everything is trade-off • It depends on how much user knows webpack and also the type of applications
care everything from view to API from 10 years ago. • There is a case that rails is used only for API nowadays, the major frontend battlefield has been moved away from Rails. ◦ For frontend, SPA is getting more popular.
if webpacker has eject feature? ◦ As an escape route when webpack config can’t be easily configured if webpacker has hard code. ◦ For those who are familiar with webpack don’t need webpacker layer. ◦ We can start with webpacker until we reach the problems. • Alright, I think I can easily add eject feature... ◦ Tried: https://github.com/rails/webpacker/pull/1916
webpack config ◦ Take over the settings of loader ▪ e.g. Using babel-loader • Prepare helper methods ◦ Extracting view helper is additional step. So use webpacker’s one for now.
config dynamically is difficult with the current implementation of webpacker. ◦ Parse source code seems over engineered. ◦ Double maintenance for templates of eject codes and webpacker’s codes. ◦ This problems is how to compose object. • So I had to take approach to write template and read the current settings of rails application. Then generate config.
use webpack-merge to compose webpack config. ◦ The code of webpacker itself can be readable. ◦ Learning-cost might be less since webpack-merge is used in the frontend community ◦ Eject can be easily implemented since it just needs to be copied. • If we change API, it will require migration too. • Another problem is I don’t have enough passion to do that.
many changes in architecture like serverless and microservice. • As I already work with SPA since 2013 and use rails just as api server. • I don’t see the future that I use Rails which handles everything inside as 10 years ago ◦ as I did to turn off turbolinks when turbolinks was just released.
should handle webpack. • While the role of Rails is expanding, the current position of webpacker is not that bad. • Unless you really need to do, you don’t need to discard webpacker