From 18a50d00b7004986d778c8039e50a81cf5b8a8e9 Mon Sep 17 00:00:00 2001 From: Benjamin Plouzennec Date: Sat, 18 Apr 2020 00:12:20 +0200 Subject: [PATCH] fix: clean require cache before loading file content (#405) fixes issue #404 --- lib/utils/combineJSON.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils/combineJSON.js b/lib/utils/combineJSON.js index 48037cafd..3c5f2b672 100644 --- a/lib/utils/combineJSON.js +++ b/lib/utils/combineJSON.js @@ -42,6 +42,8 @@ function combineJSON(arr, deep, collision) { var file_content; try { + // This delete force require(resolvedPath) to take the latest version of the file. It's handfull when using the node package along chokidar. + delete require.cache[resolvedPath] file_content = require(resolvedPath); } catch (e) { e.message = 'Failed to load or parse JSON or JS Object: ' + e.message;