Code Monkey home page Code Monkey logo

Comments (12)

alerque avatar alerque commented on July 21, 2024

We should not assume end users will ever have node installed. The main use case I have for this kind of front-end interface is to get non-developers started with a ready-to-use single purpose GUI.

If there are things being bundled that are not used at all, of course it could be trimmed down to just what is required to run, but the bundle should be self contained and ready to roll without further downloading.

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

As @alerque said, the app should work in non-developer's environment. Just download and extract it.

If I could, of course I want to shrink its bundled size. However I'm not good at this topic. Would you tell me whether there is any way?

from desktop.

Pomax avatar Pomax commented on July 21, 2024

Yeah, removing them entirely is probably a bad idea, but most deps in node_modules don't need all the files they come with for your code to work (you don't need the tests and docs and all that if you're using them as actual code dependencies in a deployed project).

I would recommend using something like webpack, which despite having "web" in the name also comes with the ability to bundle "for node", so you can point it at the entry file for your application, and it'll generate a full bundle that acts as a node library that you can then write a trivial one-line application.js file with content require('./bundle') for, and then run as node application.js. Make webpack minify the bundle, and things get really nice.

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

Thanks, I'll check.

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

I tried webpack at 174988a.

Most of app's size is occupied by Electron itself. So the size won't be reduced by webpack.
However, the number of files decreases much. This is effective when extracting the archive.

from desktop.

Pomax avatar Pomax commented on July 21, 2024

interesting finding, how little of a difference does it make in terms of size?

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

On Windows 64bit:

version zip extracted files folders resources/app
v1.0.3 52.6MB 133MB 3476 270 12.2MB
174988a 48.8MB 125MB 105 13 4.06MB

from desktop.

Pomax avatar Pomax commented on July 21, 2024

interesting. Yeah that's not too much space saved (although 4mb on 52/48 is still considerable), but that's an amazing reduction in files. Out of curiosity, which zipper did you use? If the resources/app set went down by over 8mb, I'd imagine something like 7z should be able to reflect that in the packed size, too

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

v1.0.4 is released. It uses webpack.

from desktop.

Pomax avatar Pomax commented on July 21, 2024

you are a hero

from desktop.

Pomax avatar Pomax commented on July 21, 2024

btw, perhaps interesting to know, using 7z rather than plain zip for compression gives me a 31MB archive for 1.0.4 (set to best compression, since it's a release pack), rather than 51MB, so that's a drastic savings, too. Might be worth using 7z for future releases.

from desktop.

yuya-oc avatar yuya-oc commented on July 21, 2024

I know 7z can compress better than zip, however, it's not supported by os. So I will use only plain zip. Thanks.

from desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.