Skip to content

Commit

Permalink
refactor(runtime-node): reuse importModules (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
AviVahl authored Aug 10, 2023
1 parent 4f74a8a commit d28dc35
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/runtime-node/src/remote-node-entry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'node:path';
import type { ServerOptions } from 'socket.io';
import { ForkedProcess } from './forked-process.js';
import { importModules } from './import-modules.js';
import { launchEngineHttpServer } from './launch-http-server.js';
import { parseCliArguments } from './parse-cli-arguments.js';
import { createIPC } from './process-communication.js';
Expand All @@ -20,13 +21,7 @@ const basePath = path.resolve(providedPath);
const httpServerPort = preferredPort ? parseInt(preferredPort as string, 10) : undefined;

(async () => {
for (const requiredModule of requiredPaths) {
try {
await import(require.resolve(requiredModule, { paths: [basePath] }));
} catch (ex) {
throw new Error(`failed importing: ${requiredModule}`, { cause: ex });
}
}
await importModules(basePath, requiredPaths);
const { socketServer, close, port } = await launchEngineHttpServer({
staticDirPath: path.join(basePath, 'dist'),
httpServerPort,
Expand Down

0 comments on commit d28dc35

Please sign in to comment.