bellard / quickjs

Public repository of the QuickJS Javascript Engine.
https://bellard.org/quickjs
Other
8.57k stars 899 forks source link

examples/hello_module is broken, produces "TypeError: not a function" #240

Open gavrilyak opened 9 months ago

gavrilyak commented 9 months ago

Static JS compilation with modules worked in 2022 release.

git` bisect run /bin/sh -c "make clean examples/hello_module && ./examples/hello_module"

gives

6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7 is the first bad commit
commit 6e4931c4ad6c1f06cd1e46ecbf98e04cbb8b4ba7
Author: Fabrice Bellard <fabrice@bellard.org>
Date:   Wed Dec 27 17:10:47 2023 +0100

    top-level-await support - follow the spec in the implementation of the module linking and evaluation to avoid errors with cycling module dependencies
gavrilyak commented 9 months ago

The cause is -fno-promise in HELLO_MODULE_OPTS in Makefile, it works after removing it. Looks like since the mentioned commit the module loading uses Promise internally, so -fno-promise won't work anymore.