Packaging with all dependencies/devDependencies removed from package.json - why does it work?

  • I am developing an Electron app using Quasar framework.

    Due to restrictions, my node_modules are static (not allowed to download anything online and have a fixed node_modules locally - just copy paste in new project if the need arises). I never run npm init.

    So in an attempt to minimize the bundled application size, I did an experiment and removed all dependencies and devDependencies from my package.json.

    • I ran the app and it still works.
    • But what surprised me is when I packaged the app, it still works. I do not get any errors stating that the required node_modules are missing.

    How come? Could this be of webpack, babel or something that has been bundled on the Quasar framework? Maybe the imported commands were compiled with the code and don’t need them to be included anymore as separate node_modules (ie in dist/electron/AppName/resources)?

    This is good news for me. But just wanted to understand why and if this will cause grave errors/crashes whatsoever.


  • The package.json is just for your package manager to know what to install in node-modules. If you are not managing packages, you don’t need the package manager. 😉
    Depending on your quasar.config settings, the actual bundle is mostly determined by treeshaking during your build - i.e., if your code asks for it, it is included in the build.

  • This post is deleted!

  • @AndrewE This clarifies it for me. Thanks so much! 🙂

Log in to reply