diff --git a/package.json b/package.json index b18a3f8..d863544 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proddash", - "version": "1.9.0", + "version": "1.9.1", "private": true, "description": "Modular production dashboard for Waters Church \u2014 zero-dependency Node server + vanilla client", "license": "UNLICENSED", diff --git a/server.js b/server.js index ebb66b9..c16d7cd 100644 --- a/server.js +++ b/server.js @@ -373,7 +373,18 @@ function mountModule(id) { const log = makeLog(id); try { const serverPath = path.join(man.dir, man.server); - // Re-require fresh config on every (re)mount; the module code itself stays cached. + // Drop the module's code from the require cache so every (re)mount runs + // the files on disk. Without this a module UPDATE swaps the folder while + // the process keeps executing the old code until ProdDash itself + // restarts — the manifest (read fresh from disk) then reports a version + // the running code isn't, and anything new in the update silently + // doesn't happen. Modules already have to come up clean on re-init + // (module guide), so a fresh load on config remounts is the same + // contract without the trap. + const cachePrefix = man.dir.endsWith(path.sep) ? man.dir : man.dir + path.sep; + for (const key of Object.keys(require.cache)) { + if (key.startsWith(cachePrefix)) delete require.cache[key]; + } const mod = require(serverPath); const config = effectiveConfig(id); // What a module needs to reach the rest of ProdDash — another module's