Ionic 2: Size of node_modules folder

Dear Ionic-Team,

first of all, thank you so much for providing the Ionic Framework as an open source project. I’ve been working with Version 1.x back in 2015 in my course “Mobile App Development” at the Munich University of Applied Sciences. My students and I have been excited about the look and feel of the apps that we have created with Ionic.

For the next round of the course, which will start in October 2016, I am looking at Ionic 2. Looking at the current beta, it seems that it will be even more fun this year. There is only one thing that strikes me a bit with Ionic 2: The large size of the folder “node_modules” inside of an Ionic-2-project-folder, which is more than 100 MByte.
During the course, we usually look at 10 to 20 different example projects, resulting in 1 to 2 GByte per student.

My questions are:

  1. Is it planned to keep the large “node_modules” folder or will it go away in the release version of Ionic 2?
  2. If it will not go away, is there a way to have the large “node_modules” folder installed “globally” just once and use it by 10 or 20 projects? (I know that there are symbolic links, but maybe there is a more transparent solution, e.g. similar to an npm install -g …)

My system config is:

Cordova CLI: 6.3.0
Ionic CLI Version: 2.0.0-beta.36
Ionic App Lib Version: 2.0.0-beta.19
OS: Windows 8.1
Node Version: v5.12.0

Many thanks and best regards,

The node modules folder is going to stay. This is part of modern JS build tools right now, so it needs to stick around.

As for the global installs, it’s not recommended to do this. Local installs are the recommended way to handle build tools.

If you’re concerned about folder size, you can always remove the node modules between projects

Mike, thanks a lot for your quick and clear answer.

Personally, I don’t feel that “modern build tools” will copy themselves into every single project folder on the long run. I would imagine that there will be at least one central point where various versions of the tools can be stored and shared among projects, similar to the ~/.gradle folder of the gradle wrapper. But this is just my view and I might be wrong.

Anyway, I certainly respect the architectural decisions of the Ionic Team and will try to find a “local” solution for my Ionic training course.

Many thanks and best regards,