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
Have same problem and solved with asar: true in package config (about asar packing), but asar contains all project files (include all from .gitignore etc.), it is simple to check using npx @electron/asar extract app.asar ./dist, also its means can contain confidential dev information (.env and other)
Have same problem and solved with asar: true in package config (about asar packing), but asar contains all project files (include all from .gitignore etc.), it is simple to check using npx @electron/asar extract app.asar ./dist, also its means can contain confidential dev information (.env and other)
Remove other project files (also I use vite, and it's having cache in node_modules/.vite, that not removed by prune). Use ignore in packager config (docs) for that all:
If extract the app.asar with webpack template, there are only three content:
.webpack: the webpack output
node_module: it is an empty folder because of all bundle into webpack output
package.json
I think the vite should be same with webpack, the asar should only include the .vite output folder but not most source code. The vite also have another problem: it not support the node native module.
To sum up, I will use the webpack in electron application development.
Activity
akash07k commentedon Dec 9, 2023
I noticed that
asar: trueis not there in the generated forge config via this template. could this be the issue?Viiprogrammer commentedon Dec 9, 2023
Have same problem and solved with
asar: truein package config (about asar packing), but asar contains all project files (include all from.gitignoreetc.), it is simple to check usingnpx @electron/asar extract app.asar ./dist, also its means can contain confidential dev information (.envand other)akash07k commentedon Dec 10, 2023
Yeah
Viiprogrammer commentedon Dec 10, 2023
After a few hours, I think I fully understand how to deal with it.
prune: truein packager config - docsdevDependecies(pruneremoves only dev deps, not all unused)node_modulesafterprune(optional, you can skip):Code spoiler
and add to packager config:
vite, and it's having cache innode_modules/.vite, that not removed byprune). Useignorein packager config (docs) for that all:Code spoiler
After all of that, my asar deceased from ~700mb - 1GB to 13 MB, and can be less
Result config:
Code spoiler
also you can add
package.jsoncleanup inafterPrune, just copy and paste after empty dirs cleanupnnsay commentedon Dec 26, 2023
If extract the
app.asarwith webpack template, there are only three content:I think the vite should be same with webpack, the asar should only include the
.viteoutput folder but not most source code. The vite also have another problem: it not support the node native module.To sum up, I will use the webpack in electron application development.
caoxiemeihao commentedon Jan 12, 2024
Next version of Vite plugin will enabled
asarby default.akash07k commentedon Jan 14, 2024
Will it be 0.29?
caoxiemeihao commentedon Jan 18, 2024
Is
@electron-forge/plugin-viteinstead ofvite-plugin-electron😅caoxiemeihao commentedon Feb 9, 2024
Implemented by #3480