Rollup plugin cache vs full rebuilds for zero-downtime migration of a small app
0 reputation · 07 Nov 2020, 19:28 UTC
I'm planning to migrate a small application's Rollup-based build pipeline to a new server with no downtime, and I need to decide how to handle build caching during the cutover. Rollup supports incremental builds that skip reprocessing unchanged modules, keyed by module ID, but this depends on plugins implementing the buildStart hook correctly to participate in caching.
The constraint: the pipeline uses several third-party plugins, and it's unclear which of them handle cache invalidation properly. Some plugins reportedly force complete rebuilds regardless of incremental mode, and cache behavior differs between --watch mode and programmatic builds via the JavaScript API. A stale or partially invalidated cache during migration could produce inconsistent output between the old and new environments.
The two candidate approaches are: (1) rely on Rollup's incremental cache and audit each plugin for buildStart/buildEnd support, or (2) disable caching entirely and accept full rebuilds on every run during the migration window.
Which approach carries less risk of inconsistent artifacts when builds may run on both old and new infrastructure in parallel? Is there a documented way to inspect which plugins are opting out of incremental caching? Does cache behavior differ enough between watch mode and programmatic builds to affect this decision?