Webpack is the future. We're using it in our latest Rails applications.
For tests, we want to compile assets like for production.
For parallel tests, we want to avoid 8 workers compiling the same files at the same time.
When assets did not change, we do not want to spend time compiling them.
Here is our solution for all that.
Its concept should work for all test suites.
Copy the following to
config/initializers/webpacker_compile_once.rb. It will patch Webpacker, but only for the
It's a good idea to compile your Webpacker assets once before your end-to-end integration test suite. Otherwise the first rendered
To compile assets before all Cucumber scenarios, copy the following to
That's it. Enjoy! 🎉
Similar scenario: running an application with Webpacker on multiple servers. How to serve identical assets from all servers.