You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
I looked very closely at how Atom implements electron-link, but I for the world cannot get it to work... It also seems like almost none is actually using this, which is a shame, because it's a pretty cool feature. Hence I'm going to document what I have done, so others can learn from it and save themselves a day of work. Anyway, some help would be very much appreciated to get it running. I feel like I'm close, but I'm just not seeing what I'm missing...
I made a snapshot.js which contains the following:
The two files from the snapshot.js are of the following format:
module.exports = function() {
//Do stuff
}
My startup.js, which is set in package.json, does the following:
var main;
if (typeof snapshotResult !== 'undefined') {
snapshotResult.setGlobals(global, process, global, {}, console, require);
main = snapshotResult.customRequire("./main");
}
else {
main = require("./main");
}
main();
main() effectively runs the module.exports from before, creates a BrowserWindow with a preload-script, which in turn requires native.js in a similar fashion.
Everything works fine when trying out using electron app from the CLI. But after building, and replacing the default snapshot_blob.bin, it simply does not work, at all.
Can someone please point out what I'm missing?
PS. I also notice, when I open the snapshot_blob.bin with notepad, the whole generated snapshot.js is fully readable, kind of defeating the point of compiling it (other than speed). What's up with that?
The text was updated successfully, but these errors were encountered:
Did you figure out how to make electron-link work? I have successfully made the snapshot_blob.bin but there seems to no difference in performance. In both cases, the app load time is around 450ms.
I looked very closely at how Atom implements electron-link, but I for the world cannot get it to work... It also seems like almost none is actually using this, which is a shame, because it's a pretty cool feature. Hence I'm going to document what I have done, so others can learn from it and save themselves a day of work. Anyway, some help would be very much appreciated to get it running. I feel like I'm close, but I'm just not seeing what I'm missing...
I made a
snapshot.js
which contains the following:The two files from above are the only two I need a snapshot from. I guarded them with an
if(false)
so I have complete control when to load them.I use the following
compile.js
, roughly based on Atom, but very simplied:The two files from the
snapshot.js
are of the following format:My
startup.js
, which is set inpackage.json
, does the following:main()
effectively runs themodule.exports
from before, creates a BrowserWindow with a preload-script, which in turn requiresnative.js
in a similar fashion.Everything works fine when trying out using
electron app
from the CLI. But after building, and replacing the defaultsnapshot_blob.bin
, it simply does not work, at all.Can someone please point out what I'm missing?
PS. I also notice, when I open the
snapshot_blob.bin
with notepad, the whole generatedsnapshot.js
is fully readable, kind of defeating the point of compiling it (other than speed). What's up with that?The text was updated successfully, but these errors were encountered: