Problem with custom import function #1334
Unanswered
JerrySievert
asked this question in
Q&A
Replies: 4 comments 1 reply
|
When you use compile only you need to run the result afterwards with JS_EvalFunction. |
0 replies
|
hm, either I'm not understanding you fully (I could be being very dense), or there's still something amiss: my expected behavior would be to have it print: I get the any help is much appreciated |
0 replies
|
This line is unsound: JSModuleDef *module = (JSModuleDef *)JS_VALUE_GET_PTR(res2);JS_EvalFunction returns a promise object, not a module object. Try this instead: res2 = js_std_await(ctx, res2);
if (JS_IsException(res2)) {
js_std_dump_error(ctx);
exit(1);
}
JSModuleDef *module = JS_VALUE_GET_PTR(res2);Awaiting promises recursively can deadlock so caveat emptor. |
1 reply
seems to work a little better, but I haven't tested all failure modes yet |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
My goal is to have a custom import function, such as:
or
from looking at code, it should be fairly straightforward:
but, when I do this, I get an illegal access in
js_build_module_ns().here's a quick, dumbed down repo of the inner workings:
and my invalid access occurs here:
any help or pointers would be very much appreciated.
thanks!
All reactions