From 4f589a8b49729e28d3065add33aea8547eb7f71f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 1 Apr 2021 16:28:51 +0100 Subject: [PATCH] Fixing an issue with server still expecting tmp directory to be created externally and updating component library to not cache with require in dev. --- packages/server/src/utilities/fileSystem/index.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 8d5c5c9b08..17169528d3 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -22,13 +22,7 @@ const fetch = require("node-fetch") const DEFAULT_AUTOMATION_BUCKET = "https://prod-budi-automations.s3-eu-west-1.amazonaws.com" const DEFAULT_AUTOMATION_DIRECTORY = ".budibase-automations" -const NODE_MODULES_PATH = join( - __dirname, - "..", - "..", - "..", - "node_modules" -) +const NODE_MODULES_PATH = join(__dirname, "..", "..", "..", "node_modules") /** * The single stack system (Cloud and Builder) should not make use of the file system where possible, @@ -178,12 +172,15 @@ exports.getComponentLibraryManifest = async (appId, library) => { const path = require.resolve(library).split(lib)[0] return require(join(path, lib, filename)) } else if (env.isDev()) { - return require(join( + const path = join( NODE_MODULES_PATH, "@budibase", "standard-components", filename - )) + ) + // always load from new so that updates are refreshed + delete require.cache[require.resolve(path)] + return require(path) } const path = join(appId, "node_modules", library, "package", filename) let resp = await retrieve(ObjectStoreBuckets.APPS, path)