Skip to content

Commit 61851e6

Browse files
committed
Bug fix
1 parent d8ce4da commit 61851e6

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

core/Run.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ namespace Moduless
9292
const ex = require(project.outFile);
9393
if (ex && typeof ex === "object" && !Array.isArray(ex))
9494
out.push({ project, exported: ex });
95+
96+
// Globalize the exports of the project.
97+
for (const [name, value] of Object.entries(ex))
98+
{
99+
if (name in globalThis)
100+
{
101+
console.warn(
102+
`Skipping adding ${name} from ${project.projectPath} to global scope ` +
103+
`because another member with this name is already defined globally.`);
104+
105+
continue;
106+
}
107+
108+
(globalThis as any)[name] = value;
109+
}
95110
}
96111
catch (e)
97112
{
@@ -115,24 +130,6 @@ namespace Moduless
115130
if (!startingProject)
116131
throw new Error("No projects found at location: " + target.projectPath);
117132

118-
// Globalize the exports of all projects.
119-
for (const { project, exported } of graph)
120-
{
121-
for (const [name, value] of Object.entries(exported))
122-
{
123-
if (name in globalThis)
124-
{
125-
console.warn(
126-
`Skipping adding ${name} from ${project.projectPath} to global scope ` +
127-
`because another member with this name is already defined globally.`);
128-
129-
continue;
130-
}
131-
132-
(globalThis as any)[name] = value;
133-
}
134-
}
135-
136133
const tryResolveNamepace = (root: object) =>
137134
{
138135
let current: any = root;

0 commit comments

Comments
 (0)