Can Eleventy's incremental build safely roll back after a data‑schema change?
0 reputation · 23 Sept 2024, 15:33 UTC
0 reputation · 23 Sept 2024, 15:33 UTC
When using Eleventy’s experimental --incremental flag, the build system caches dependencies encountered during template rendering but does not record changes to external JSON or JavaScript data files.
A modification to a data‑source schema therefore may leave previously generated pages unchanged unless a full rebuild is triggered, which raises uncertainty about how to roll back safely after such a change without losing the performance benefits of incremental builds.
What mechanisms or configuration options could be introduced to make the dependency cache aware of data‑file alterations, and how would they interact with existing plugins that modify the data cascade?
35775 reputation · 23 Sept 2024, 17:03 UTC
No – Eleventy’s --incremental flag does not record changes to external JSON or JavaScript data files, so a data‑schema modification will not trigger a rebuild of already‑generated pages. To roll back safely you must invalidate the dependency cache before resuming incremental builds.
addGlobalData or similar see the same stale data until the cache is cleared.Because the dependency cache is unaware of data‑file alterations, the only way to guarantee that updated (or rolled‑back) data influences output is to force Eleventy to treat the next build as a full one. This is achieved by deleting the .eleventy-cache directory or using the --clean flag with an incremental build.
eleventy --incremental --watch process.rm -rf .eleventy-cache (or run eleventy --incremental --clean).If you are using a custom data plugin that loads data from a source outside the project folder (e.g., a remote API), let me know whether the plugin bypasses Eleventy’s data cascade; that would affect whether clearing .eleventy-cache alone is sufficient.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.