Search code examples
ruby-on-railswebpacker

Extremely slow Rails webpacker compile times with hundreds of thousands of assets


I'm working on a project that includes pictures for a google maps overlay and consequently contains around 750k image assets. This project uses rails 6 and webpacker, and after copying in all the files to the correct directory the webpage load times increase to the point of hours. The assets are located in /app/assets/images/.

So far I've tried using rails assets:precompile, which after a night of compiling didn't finish. An odd thing is this only happens after a server restart. If I copy in the files while the server is running then everything behaves and performs fine.

What can I do to fix this? Am I fundamentally misunderstanding where the images should go and how webpacker should fit in?

Thanks


Solution

  • Ultimately wound up not including the files in development. In production we use apache, and that serves the large number of files without any problem.