Skip to content

Commit 958b829

Browse files
committed
fix: fix ll.import and ll.export for nodejs engine (#270)
1 parent 71313ed commit 958b829

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/legacy/main/NodeJsHelper.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@ bool loadPluginCode(script::ScriptEngine* engine, std::string entryScriptPath, s
155155
using namespace v8;
156156
EngineScope enter(engine);
157157

158-
string compiler;
158+
string compiler = R"(
159+
ll.import=ll.imports;
160+
ll.export=ll.exports;)";
161+
159162
if (esm) {
160-
compiler = fmt::format(
163+
compiler += fmt::format(
161164
R"(
162165
import('url').then(url => {{
163166
const moduleUrl = url.pathToFileURL('{1}').href;
@@ -174,7 +177,7 @@ bool loadPluginCode(script::ScriptEngine* engine, std::string entryScriptPath, s
174177
entryScriptPath
175178
);
176179
} else {
177-
compiler = fmt::format(
180+
compiler += fmt::format(
178181
R"(
179182
const __Path = require("path");
180183
const __PluginPath = __Path.join("{0}");

0 commit comments

Comments
 (0)