Skip to content

import a c or js module and print it, show exception in quickjs #832

@1DumbCicada

Description

@1DumbCicada

i just print an outside module

**test_fib.js**

import * as os from "qjs:os";

const isWin = os.platform === 'win32';
// const { fib } = await import(`./fib.${isWin ? 'dll' : 'so'}`);
import(`./fib.${isWin ? 'dll' : 'so'}`).then(
    (res)=> {
        console.log('quickjs env', res)
    }
)

but show an exception tag

PS D:\Quickjs\build> ./qjs.exe test_fib.js
quickjs env <exception

then i test in node env

**es_li.mjs** 

export function hello() {
    
}

**test_fib.js**
import("./es_li.mjs").then(
    (res) => {
        console.log('node env', res)
    }
)

it is ok

PS D:\Quickjs\build> node test_fib.js
node env [Module: null prototype] { hello: [Function: hello] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions