quickjs icon indicating copy to clipboard operation
quickjs copied to clipboard

Module Access

Open justin0mcateer opened this issue 5 years ago • 4 comments

What is the current expectation around module functionality? I don't seem to be able to utilize the in-build QuickJS modules like 'console' or 'std'. Am I doing something wrong, are these expected to be available?

If I try to load external modules, I get the following error: _quickjs.JSException: ReferenceError: could not load module

justin0mcateer avatar Oct 30 '20 18:10 justin0mcateer

No they are not available at all.

PetterS avatar Oct 30 '20 19:10 PetterS

I have a couple of PRs (#21, #22) that have experimented with adding support for modules in different ways.

What you can do now is to expose Python functions to the JS code.

PetterS avatar Oct 30 '20 19:10 PetterS

I saw those PRs. Are they usable at all? One approach appears to primarily lean on additional C code from the QuickJS project. Can you comment on which approach might be the best way forward and what remains to be done to make it useful?

justin0mcateer avatar Nov 05 '20 15:11 justin0mcateer

#21 should make built-in QuickJS modules available.

But I don't really want to make them available. I am more interested in being able to parse and import JS modules.

PetterS avatar Nov 05 '20 15:11 PetterS