electron-userland / electron-json-storage

:package: Easily write and read user settings in Electron apps
1.43k stars 79 forks source link

After depend on electron-json-storage, the exe or dmg becomes bigger. from 50M to 100M! #114

Closed linxu closed 6 years ago

linxu commented 6 years ago

After depend on electron-json-storage, the exe or dmg becomes bigger. from 50M to 100M!

Nantris commented 6 years ago

Something else is certainly responsible for this. If you're using Webpack, use the BundleAnalyzerPlugin to determine what's adding this size to your output file. Also be aware that you can use the ASAR tool to unpack your app.asar file (or equivalent) and explore the contents.

linxu commented 6 years ago

i use electron-forge

Nantris commented 6 years ago

I'm pretty certain electron-forge uses Webpack. In any event you can extract the contents of your ASAR file.

wduminy commented 6 years ago

@linxu I also saw some unexpected electron dependencies being pulled in while using a slightly older electron. However, after I upgraded to electron to v2.0.7 things returned to normal.

So you could try to upgrade your electron-forge to the latest version.

fyjham-ts commented 6 years ago

Have had the same issue using electron-builder v20.28.2 to build with a reference to electron-json-storage.

This folder is introduced into the built output if I depend on electron-json-storage "\resources\app.asar.unpacked\node_modules\electron" - it seems to require electron as a dependency & hence causes the builder to include it in the app (Despite the fact it's already in there)...

Nantris commented 6 years ago

@jviotti should electron be a dependency here or a peerDependency?

jviotti commented 6 years ago

@Slapbox @fyjham-ts That's absolutely correct. Thanks a lot for catching this! Do you want to send a PR? I'll approve and publish ASAP

Nantris commented 6 years ago

@jviotti thanks for your quick response. I just sent over https://github.com/electron-userland/electron-json-storage/pull/115 .

I haven't tested it besides for invalid JSON, but I see no reason this shouldn't work.

linxu commented 6 years ago

cool

jviotti commented 6 years ago

I published the fix as v4.1.2. I'll close this ticket now, but please let us know how it went :)