From 9a86d2772369462e391f993dac0efdd1ab286f66 Mon Sep 17 00:00:00 2001 From: Austin Devine Date: Fri, 16 Aug 2024 19:56:41 +0100 Subject: [PATCH] fix(ui5-tooling-transpile): fix for loading replaceVersion --- packages/ui5-tooling-transpile/lib/task.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/ui5-tooling-transpile/lib/task.js b/packages/ui5-tooling-transpile/lib/task.js index 0e570f8a2..b3e39c518 100644 --- a/packages/ui5-tooling-transpile/lib/task.js +++ b/packages/ui5-tooling-transpile/lib/task.js @@ -74,12 +74,20 @@ module.exports = async function ({ log, workspace /*, dependencies*/, taskUtil, // replace the version in all files handled by this task because this plugin handles additional file types // which are not supported by the replaceVersion task of the UI5 Tooling (hardcoded some selected file types) - // (HINT: do this a bit loosly coupled for now to avoid tight dependencies to UI5 Tooling) + // (HINT: do this a bit loosely coupled for now to avoid tight dependencies to UI5 Tooling) + // Also check for @ui5/builder under @ui5/cli to avoid issues with the module resolution try { // dynamically require the replaceVersion task // (using the absolute path to the module to avoid issues with the module resolution) - const replaceVersion = (await import(pathToFileURL(require.resolve("@ui5/builder/tasks/replaceVersion")))) - .default; + const replaceVersion = ( + await import( + pathToFileURL( + require.resolve("@ui5/builder/tasks/replaceVersion", { + paths: [cwd, `node_modules${path.sep}@ui5${path.sep}cli`] + }) + ) + ) + ).default; // replace the versions for all supported file types // using the central replaceVersion task of the UI5 Tooling await replaceVersion({