DEV Community


Discussion on: Bundle your Node app to a single executable for Windows, Linux and OsX

jochemstoel profile image
Jochem Stoel Author

You can include assets in your package too.

eduar2 profile image
Eduardo Arcentales

Well, I can reach it, my "only" problem now is if I execute in Windows to create a executable windows file, it works. But if I create my exe in Linux, when I go to Windows Machine it doesn't work.

Thread Thread
jochemstoel profile image
Jochem Stoel Author

Does it throw an exception file not found when your run it? That might have something to do with the 'virtual' path your assets are stored. Those are not consistent on every platform.

Packaged files have /snapshot/ prefix in their paths (or C:\snapshot\ in Windows). If you used pkg /path/app.js command line, then __filename value will be likely /snapshot/path/app.js at run time. __dirname will be /snapshot/path as well.

Possibly useful:
detecting assets
snapshot filesystem

Forem Open with the Forem app