Try adding the `--module` flag [1]. JS now has two different grammars, script and module, and the `import` keyword is only allowed in module code.
[1] https://bellard.org/quickjs/quickjs.html#qjs-interpreter
Ah yes of course – thanks, works as advertised now! :o)
Really cool stuff!
Heads up, I had to unset CONFIG_M32=y on macOS Catalina. There are no headers or symbols for 32bit apps in macOS anymore, so this will exclude the *32 variant targets.
similar here. but I did not understand where CONFIG_M32=y is set. it is uncommented and must be set in somehwhere of Makefile. did not find the position.
ifndef CONFIG_WIN32
# force 32 bit build for some utilities
# CONFIG_M32=y
find it here.
Thinking this probably didn't matter much I went ahead and ran `./qjs examples/hello.js` which worked as advertised – cool! Tried `./qjsbn examples/pi.js 5` and it worked as well – very cool! Then I tried `./qjs examples/hello_module.js` and got this:
I don't know what I did wrong – anyone else try it yet?