Hacker News new | past | comments | ask | show | jobs | submit login

I just tried building this on my Mac and it looked initially like it all was building fine, but it eventually failed when building qjs32.

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:

    SyntaxError: unsupported keyword: import
        at examples/hello_module.js:3
I don't know what I did wrong – anyone else try it yet?



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.


Try ./qjs -m examples/hello_module.js




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: