MCPcopy Create free account
hub / github.com/0xcaff/codex-web / installModuleAliasHook

Function installModuleAliasHook

src/server/module.ts:4–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import path from "node:path";
3
4export function installModuleAliasHook(): void {
5 const moduleWithLoad = Module as typeof Module & {
6 _load: (
7 request: string,
8 parent: NodeModule | undefined,
9 isMain: boolean,
10 ) => unknown;
11 };
12 const originalLoad = moduleWithLoad._load;
13
14 moduleWithLoad._load = function moduleAliasLoad(
15 request: string,
16 parent: NodeModule | undefined,
17 isMain: boolean,
18 ): unknown {
19 if (request === "electron") {
20 return originalLoad.call(this, path.resolve(
21 path.resolve(__dirname, "../.."),
22 "src/server/electron/index.js",
23 ), parent, isMain);
24 }
25
26 return originalLoad.call(this, request, parent, isMain);
27 };
28}

Callers 1

startIpcBridgeServerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected