What is node_modules directory in AngularJS?

后端 未结 2 1995
傲寒
傲寒 2021-01-03 19:44

I am exploring AngularJS tutorial project and found it has node_modules directory inside, which size if 60 megabytes.

Does simple clientside javascript

2条回答
  •  春和景丽
    2021-01-03 20:23

    NPM is the node package manager, which installs packages locally into a project, specifically, into the node_modules folder. From there the package code can be included into a project, yes, can is the important word there.

    The browser has no way to include modules in code (yet), so you need to use a library that can expose node's commonJS style modules. Browserify and Webpack are two popular methods of doing so.

    Angular complicates this by introducing its own module system, which more closely resembles AMD-style modules. There are ways around this, so that you can use node-style modules, maybe your project uses those.

    Using npm for managing dependencies is a great idea, its a fantastic package manager. It is likely in your case though that the project is only built using node and that the node_modules folder contains dependencies only related to the build.

提交回复
热议问题