[quickjs-devel] import in interactive cli

  • From: PaulC <paulc@xxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Sat, 19 Jun 2021 14:00:27 +0100

Hi,

Is there a way of importing a module in the CLI. If I run the import command 
directly this doesn't work.

$ qjs
QuickJS - Type "\h" for help
qjs > import { Base64 } from "./base64.js";
SyntaxError: expecting '('
    at <evalScript>:1

(I have tried --module/--script)

The same thing in a script runs fine:

$ cat zz
import { Base64 } from "./base64.js";
print(Base64);
 
$ qjs zz
[object Object]

$ qjs -h
QuickJS version 2021-03-27

Thanks, Paul

Other related posts: