quickjs-rs icon indicating copy to clipboard operation
quickjs-rs copied to clipboard

Module Loading Support

Open SvanteRichter opened this issue 5 years ago • 1 comments

Hi,

Thank you so much for this wrapper!

I'm running into some problems when loading modules, all I get back is ReferenceError: could not load module when running for example the following:

use quick_js::{Context};

fn main() {
    let context = Context::new().unwrap();
    let value = context.eval_as::<String>("(async () => {const test = await import('./js/module.js'); return test();})();").unwrap();
    println!("{}", &value);
}

With this in module.js:

export default () => {
    return 'Not working?';
};

Am I missing something obvious or is this just not supported yet?

SvanteRichter avatar Sep 06 '19 17:09 SvanteRichter

Module loading is not supported yet.

I have some initial work on it, I should be able to get to it next week. It won't be enabled by default though due to security concerns.

theduke avatar Sep 08 '19 09:09 theduke