mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
We use Webpacker *and* Sprockets to compile assets. I hadn't realised before that we were still compiling lots of JS with Sprockets. So even after we pre-compiled assets with Webpacker, we still needed to compile more assets on the first page visit in test environment. That made some time-critical specs, like caching specs, fail. This approach pre-compiles all assets but only in CI. Running the compilation task adds 6.5 seconds even if there's nothing to compile while the previous Webpacker call returned instantly. So I decided to run the compilation only on CI and activated on-demand compilation to the test environment. Time-critical specs will still be flaky without pre-compilation locally but I figured that a fair trade-off for faster specs in general. During most development, we don't need all assets to be compiled and it's faster to just compile what's needed. And running a time-critical spec twice solves the flakiness.