DEV Community

Shrink your Rails 7 application.js files

Anag on February 06, 2023

I discovered that my rails app was bundling a few too many stimulus controllers. Whoa! Slow down there buddy, save some of those controllers for in...
Collapse
 
konnorrogers profile image
Konnor Rogers

There’s an infinite number of ways to handle this with some techniques more advanced than others including lazy loading controllers based on controllers found in the DOM.

An easy win you could do is setup ESBuild to take in multiple entrypoints and set format to “ESM” and “splitting” to true so you can get a more granular cache and reuse code from your main application in your admin views.

Collapse
 
lucianghinda profile image
Lucian Ghinda

If you are looking for an alternative to active admin may I recommend avohq.io ?