How to Use ES6 Modules When Embedding V8

277 views
Skip to first unread message

Cisco Ortega

unread,
Jul 27, 2021, 1:22:16 AM7/27/21
to v8-dev

Hi,

The only source for using modules seems to be this Stack Overflow post here: https://stackoverflow.com/questions/52023157/how-would-one-enable-and-use-es6-modules-in-the-v8-javascript-engine

However it is still unclear to me how to actually resolve the import requests in code.  If anyone could help me with that, it would be greatly appreciated.

Thanks

Georg Neis

unread,
Jul 28, 2021, 2:48:15 AM7/28/21
to v8-...@googlegroups.com
When you instantiate the module graph, you pass a callback whose job
is to resolve the module specifiers of imports.

See the d8 implementation as an example:
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/d8/d8.cc;l=1288;drc=80def040657db16e79f59e7e3b27857014c0f58d;bpv=1;bpt=1

Best,
Georg
--
Georg Neis
Software Engineer

Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise
erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes
weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich
bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

This e-mail is confidential. If you received this communication by
mistake, please don't forward it to anyone else, please erase all
copies and attachments, and please let me know that it has gone to the
wrong person.

Cisco Ortega

unread,
Jul 28, 2021, 9:29:56 PM7/28/21
to v8-dev
Thank you!
Reply all
Reply to author
Forward
0 new messages