Node_modules folder during build

Just purely out of curiosity - what happens to the node_modules data when a production build is produce?

Does it include all the files from the folder?

Or does it only includes those which have been called from an import line in the ts files?

I think it uses only the modules added on the packege.json, the rest is auxiliary.

There are two kinds node dependencies. If you look at you package.json there is a section “devDependencies”. Node libraries included in these are never used in prod builds. These mostly include libraries that are used to assist in development process e.g testing , module bundler, transpilers etc.

From Ionic 2 perspective production build has a final JS bundle which is a transpiled, concatenated and minified JS file with all the modules (and their dependencies) that you used/imported in your code.