How to create and use a V8 snapshot in an Angular application in Electron?

Viewed 157

I have an Angular application that resides in Electron. I try to speed up its startup, and I found that it is possible to create a V8 snapshot with the dependencies already inside to save some loading time. Atom did this and it works well.

I tried the following:

  1. Created a JS file that requires all the dependencies.
  2. Ran electron-link with that JS file.

Then, when verifying the snapshot to make sure it will work with the mksnapshot tool, I got errors like the following:

ReferenceError: setTimeout is not defined

I did manage to load react into a V8 snapshot, but I can't load Angular this way.

Maybe someone managed to create a V8 snapshot with Angular?

Angular uses webpack to create a bundle of the application, so I guess that I need to load the bundle to the snapshot somehow (from vendor.js and others), but I didn't succeed doing it also. Maybe webpack can create a snapshot by itself?

Any help would be appreciated.

Thanks in advance!

0 Answers
Related