Snapshot a module app

20 views
Skip to first unread message

Ronald Fenner

unread,
Jul 16, 2021, 12:34:48 AM7/16/21
to v8-u...@googlegroups.com
I was wondering how one would go about building a snapshot of an app that used only imports to include other js files.
As I understand the static module flow from d8 it's

Load the root module contents
Compile Root Module
Load all and compile unique modules imported in the import tree
Instantiate the root module 
Evaluate the root module.

My question is when building the snapshot what steps would be required to load everything but not run the root modules actual running of the app.

I'm assuming that at a minimum it's load and compile all the modules. Would one need to call Instantiate as well?

I take that Evaluating the module is akin to calling Run on a normal script so if so then that would wait till the snapshot was loaded.

Another question at what point are dynamic modules loaded is during the evaluation phase? 
If I'm trying to bundle all the app's code into a snapshot and it's during the evaluation phase then I would need to probably disallow dynamic module loading, I take if you don't hook up the dynamic module loading callbacks then V8 would throw an error at some point.


Reply all
Reply to author
Forward
0 new messages