Skip to content

Commit

Permalink
fix(ui5-tooling-modules): windows compatibility of caches
Browse files Browse the repository at this point in the history
  • Loading branch information
petermuessig committed Oct 5, 2024
1 parent 434de2f commit c857626
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/ui5-tooling-modules/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,10 @@ module.exports = function (log, projectInfo) {
// for later resolution of the module path (e.g. the mapping in browsers field)
if (path.isAbsolute(moduleName)) {
// lookup the parent dirs recursive to find package.json
if (moduleName.lastIndexOf("/node_modules/") > -1) {
const localModuleRootPath = moduleName.substring(0, moduleName.lastIndexOf("/node_modules/") + "/node_modules/".length);
const localModuleName = moduleName.substring(localModuleRootPath.length);
const nodeModules = `${path.sep}node_modules${path.sep}`;
if (moduleName.lastIndexOf(nodeModules) > -1) {
const localModuleRootPath = moduleName.substring(0, moduleName.lastIndexOf(nodeModules) + nodeModules.length);
const localModuleName = moduleName.substring(localModuleRootPath.length)?.replace(/\\/g, "/");
const [, npmPackage] = npmPackageScopeRegEx.exec(localModuleName) || [];
pkgJsonFile = path.join(localModuleRootPath, npmPackage, "package.json");
if (!existsSyncAndIsFile(pkgJsonFile)) {
Expand All @@ -756,7 +757,7 @@ module.exports = function (log, projectInfo) {
modulePath = getModulePathWithExtension(moduleName);
// if the absolute path is not a file we try to lookup the index module
if (modulePath === undefined) {
modulePath = getModulePathWithExtension(`${moduleName}/index`);
modulePath = getModulePathWithExtension(`${moduleName}${path.sep}index`);
}
} else {
// lookup the package.json with the npm package name
Expand Down

0 comments on commit c857626

Please sign in to comment.