diff --git a/.gitignore b/.gitignore index cbd617b..72cb5d9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,12 @@ examples/*.so microbench*.txt qjs qjsc +qjscalc +qjscalc.c +hello.c +hello +hello_module +repl.c run-test262 test262 test262_*.txt diff --git a/qjs.c b/qjs.c index 3c29c67..14cbf4d 100644 --- a/qjs.c +++ b/qjs.c @@ -494,11 +494,12 @@ int main(int argc, char **argv) "globalThis.os = os;\n"; eval_buf(ctx, str, strlen(str), "", JS_EVAL_TYPE_MODULE); } + //POLYFILLS BEGIN - const char *reqPF = "function require(x) { \n" - " import { y } from `String(x)` \n" - " return y \n" - "}"; + const char *reqPF = "async function require(x) { {\n" + " const y = await import(x);" // use dynamic import. + " return y;\n" + "}\n"; eval_buf(ctx, reqPF, strlen(reqPF), "", JS_EVAL_TYPE_MODULE); for(i = 0; i < include_count; i++) {