Skip to content

Commit d7ad8a1

Browse files
author
Mariusz Pasinski
committed
feat: move path slash normalization to determineModuleContext()
1 parent 64b967c commit d7ad8a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/host/src/node/babel-plugin/plugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ export function replaceWithRequireNodeAddon3(
6060
originalId: string
6161
) {
6262
const { packageName, relativePath } = determineModuleContext(resolvedPath);
63-
const relPath = relativePath.replaceAll("\\", "/");
64-
const finalRelPath = relPath.startsWith("./") ? relPath : `./${relPath}`;
63+
const finalRelPath = relativePath.startsWith("./") ? relativePath : `./${relativePath}`;
6564

6665
p.replaceWith(
6766
t.callExpression(

packages/host/src/node/path-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export function determineModuleContext(
134134
packageNameCache.set(pkgDir, pkgName);
135135
}
136136
// Compute module-relative path
137-
const relPath = path.relative(pkgDir, originalPath);
137+
const relPath = path.relative(pkgDir, originalPath)
138+
.replaceAll("\\", "/");
138139
return { packageName: pkgName, relativePath: relPath };
139140
}
140141

0 commit comments

Comments
 (0)