Packaging with all dependencies/devDependencies removed from package.json - why does it work?
I am developing an Electron app using
Due to restrictions, my
node_modulesare 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
So in an attempt to minimize the bundled application size, I did an experiment and removed all
- 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
babelor 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
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!