diff --git a/.changeset/serious-actors-run.md b/.changeset/serious-actors-run.md new file mode 100644 index 0000000000..69fc14d535 --- /dev/null +++ b/.changeset/serious-actors-run.md @@ -0,0 +1,5 @@ +--- +'@module-federation/sdk': patch +--- + +chore: use real dirName instead of urlDirName diff --git a/packages/sdk/src/node.ts b/packages/sdk/src/node.ts index 0a4ae1433c..c6f1419a63 100644 --- a/packages/sdk/src/node.ts +++ b/packages/sdk/src/node.ts @@ -92,7 +92,7 @@ export function createScriptNode( ]); const scriptContext = { exports: {}, module: { exports: {} } }; - const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/'); + // const urlDirname = urlObj.pathname.split('/').slice(0, -1).join('/'); const filename = path.basename(urlObj.pathname); const script = new vm.Script( @@ -109,7 +109,7 @@ export function createScriptNode( scriptContext.exports, scriptContext.module, eval('require'), - urlDirname, + __dirname, filename, );