Open
Description
The runtime currently handles commonjs
modules - and if an import
statement is encountered the application will crash.
The implementation is currently in ModuleInternal.mm
It would be awesome if es modules were supported, since v8 already supports them - we are just missing the implementation for loading them (same-ish logic as for commonjs)
A reduced example for supporting es modules: https://stackoverflow.com/a/52031275/2270725
The gist of it is - we have to call ScriptCompiler::CompileModule
on the source
Local<Module> module;
if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) {
// if you have a v8::TryCatch, you should check it here.
return;
}
Unresolved questions:
- Can the runtime support both types and interop between them?