How to reduce electron apps size - vue.js

My electron application is insanely big on Mac after installation. It's around 1.39GB for no apparent reason, even though it's around 70MB on Windows. I tried to unpack the dmg file to see what makes it so big then found a file called app.asar that takes a large size of the app (1.22GB) and I don't know how to unpack this file.
So my question is,
How to make the application's size much smaller like on windows?
and what does app.asar file contain?
I'm using electron-builder to build the app by the way

It depends on your app.
If your app is too heavy, then it might be natural.
If not; try removing unwanted packages in the node_modules directory using npm.
Try instructions here :
https://www.electronjs.org/docs/tutorial/application-distribution
Make electron app smaller?
https://github.com/electron/electron/issues/2003
You can also unpack the asar file using:
npx asar extract app.asar destfolder
more on that here How to unpack an .asar file?
it basically contains all you code and stuff.
I hope I could help you 😉.
some stuff added based on others comments

Related

I have created a package of an App using nw.js. How can i create a dmg file to distribute it?

Actually there i have a html, CSS and java script based app and i created build of it using nw.js technology using build command. The problem is i want the application in dmg format. please help me finding way.
thank you.
There are many different ways to package your app. You should read the documentation:
https://nwjs.readthedocs.io/en/latest/For%20Users/Package%20and%20Distribute/
I do not know of any tutorials for creating an NW.js package as a DMG. Because the final dist is a single .app file, you could distribute that directly, or compressed in a Zip file or something similar. You may be able to look up instructions around DMG packaging that is not specific to NW.js and apply the concepts. If so, and you get it to work, you should write a blog post or tutorial about it.
You can use https://www.npmjs.com/package/appdmg to create an installer for your NW App on macOS platforms.
In my ongoing development for the same i found the making a .pkg installer is better than making .dmg with reasons you can search for.
so i found two solutions for the same.
packages(an application you can package anything with signed developer id)
buildPkg(a command line process to make package)
in both you just need to add your application.app as mentioned in documentation and follow the steps.

How to split Linux (Android) ARM64 executable into small and large parts?

Background
I have an Android app which uses native ARM64 executables (essentially GCC toolchain, extracted to app directory (/data/data/%package%/somePath) on the first run) to do some work. Due to Android 10 changes files in /data/data/.. can't have executable permission anymore.
Confirmed workaround
The workaround is to make executables look like shared libraries (libsomething.so) that are extracted by Android to /data/app/%package% dir with android:extractNativeLibs="true" in AndroidManifest.xml and are allowed to have executable permission. Symlinking might be useful to mimic the previous files structure.
The problem
The problem is that all the executables (aka new "shared libs") are packed into android apk with zip compression ratio (as apk is essentially just a zip file) which could be better if it's archived with 7zip for instance and together weight more than 100Mb which is app limitation on Android (for apk files).
The question and the proposal
How can i split the executables into a small part (that goes into /data/app/%package% and a large part (or just existing executable in /data/data/%package%)? The idea is that small executable just "loads and runs" a regular one. The benefit it that regular executable is compressed with 7zip and it makes apk size much smaller due to 7zip used with a better compression ratio.
I've been looking into direction of using of UPX but having no experience with it (note i will have to prepare executable on Mac machine (or Linux with VM or Docker) to run on Android ARM64). Also i've been thinking about creating of 7z sfx but it seems to be tricky (again, it have to be created on x86_64 and run on ARM64). Also I've found some similar QA (which recommends memexec() or fexecve()), but I'm not sure what's the optimal way to go.
Ideally I'd love to have some tiny "universal" ARM64 executable (or be able to compile it from the source code with Android NDK) that just accepts cmd and a regular executable path.
PS. App bundle and dynamic delivery modules as high-level alternatives are undesired for different reasons.
PPS. UPX did not work out of box for Android 10 (seems to be security issue).

How to place Clojurescript npm-deps in production setup?

this is a simple question, but I have been puzzling over it for a while now and it doesn't have much documentation to look at:
I've got a development setup with ClojureScript, figwheel, npm deps working just fine for me. But when I produce a production, compiled JS file, it does not find the npm dependency files. So where and how do I place which of these packages in the production web server, so that they will be found and loaded?
Regards,
Chris
All files required to run your JS will be included in the compilation output after :advanced optimizations. No node_modules files will be required at all so there should not be any need to place them anywhere. Only the files produced by the build directly should be loaded.
:npm-deps however is an alpha feature with many known issues. You can use alternate solutions like webpack or shadow-cljs which work much more reliable.

Shared resources in packages made by Electron

I need to distribute a webapp in an offline version on an USB. Electron seems like a great way to make the webapp feel native and work well on all platforms. There is (potentially) just one problem: The offline version requires several huge media files and therefore there is not enough space for each package to have its own folder with the media files. This can be solved by letting the packages share a common directory on the USB. Can you tell me if this is possible with Electron. And if so, how?
(Note that each package must be available on the USB.)

ImageMagick standalone to package in application

I'm building an AIR application using Flex where I use the NativeProcess API to resize images through ImageMagick using the convert program. Does anyone know how I can package "convert" with my application without needing to install ImageMagick on the user's system?
I'm looking for a solution on Mac and PC. (especially on Mac).
I don't have that much experience with building/installing something like ImageMagick so I'm wondering if it can be done in one file (convert only) so that I can directly call it in my app without the user needing to install anything prior on his/her system.
You have to package your AIR application as native installer or with a captive runtime. Both methods allow you to add additional files to your package. Adding the convert executable won't be enough, though, because it depends on a number of ImageMagick shared libraries, loadable modules for different image formats, and possibly other files. To get started, you can add the whole ImageMagick directory to your package. You can find the path to the packaged convert executable using File.applicationDirectory.
I'm not an expert on Flex, but there is a documented method for packaging native extensions at Adobe. Won't this work?
I know this question is very old, but I have the same issue so I stumbled on it !
I actually found a Mac only workaround solution, that is to use sips instead of ImageMagick. Advantage being that sips is included in all Mac's (Well as far as I know, from 10.4 to 10.8).
In my case, all functionalities that I used ImageMagick for are also available in sips, so maybe it could fit you too !
I found someone who created static libs of convert and identify programs for Mac. For Windows these are available already on the ImageMagick website but for Mac you need to build these from source. Important on Mac is to not call Convert directly but use a bash script which sets the export paths first and then runs convert in order for it to work!