Skip to content

Commit c3824be

Browse files
refactor: simplify importModuleDynamically to use cached importNodeModule directly
Remove vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER fallback since caching prevents recursion. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 79db581 commit c3824be

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

packages/node/src/runtimePlugin.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ export const loadFromFs = (
118118
`(function(exports, require, __dirname, __filename) {${content}\n})`,
119119
{
120120
filename,
121-
importModuleDynamically:
122-
//@ts-ignore
123-
vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule,
121+
importModuleDynamically: importNodeModule,
124122
},
125123
);
126124
script.runInThisContext()(

packages/sdk/src/node.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,7 @@ export const createScriptNode =
115115
`(function(exports, module, require, __dirname, __filename) {${data}\n})`,
116116
{
117117
filename,
118-
importModuleDynamically:
119-
//@ts-ignore
120-
vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ??
121-
importNodeModule,
118+
importModuleDynamically: importNodeModule,
122119
},
123120
);
124121

0 commit comments

Comments
 (0)