Hacker News new | ask | show | jobs
by wheresvic1 2538 days ago
I'm asking this here because I don't really know where else to do so: I'm trying to compile a binary from a js source that uses the standard modules (they are loaded by default if you run the interpreter) so the following works:

    std.printf("%d\n", 1);
    std.printf("%s\n", os.platform);
However it does not compile to a binary and doing something like:

    import std from "std";
    import os from "os";

    std.printf("%d\n", 1);
    std.printf("%s\n", os.platform);
compiles via `./qjsc -m -o default_modules examples/default_modules.js` however does not execute:

    $ ./default_modules 
    SyntaxError: export 'default' in module 'std' is ambiguous
Source: https://github.com/smalldatatech/quickjs/blob/master/example...
1 comments

    import * as std from "std";
    import * as os from "os";

    std.printf("%d\n", 1);
    std.printf("%s\n", os.platform)
Awesome thanks!