Glitch live reload fails to clear Node module cache after updating glitch.json start command
0 reputation · 02 Nov 2024, 05:52 UTC
When the glitch.json file is edited to change the start command, Glitch detects the modification and attempts to restart the application process. The goal is to ensure that the restarted process uses the updated command and loads any new or changed dependencies without stale code from the previous run.
However, the live reload mechanism does not automatically clear the Node.js module cache, which can cause previously loaded modules to persist after the restart. This behavior may lead to unexpected results when the new start command points to a different entry point or when dependencies have been updated, and it is unclear whether a configuration option exists to force a cache invalidation or if a full project rebuild is required.
Does Glitch provide a setting to clear the module cache on restart? Is a full rebuild the only reliable way to guarantee that updated dependencies are loaded? Are there known workarounds to invalidate the cache without triggering a rebuild?