简体   繁体   English

用于生产的 Angular 构建

[英]Angular build for production

I am fairly new to Angular, I am currently trying to work out how to serve only the necessary files to my deployment server.我对 Angular 还很陌生,我目前正在尝试研究如何只向我的部署服务器提供必要的文件。

Ideally, I wouldn't want to include the angular library in my project repo.理想情况下,我不想在我的项目存储库中包含 angular 库。 Instead, I would like to install in the build process.相反,我想在构建过程中安装。

Like I said this is fairly new to me so am not entirely sure whether this is achievable or not?就像我说的,这对我来说是相当新的,所以不完全确定这是否可以实现?

Angular 2 will be a dependancy of your project. Angular 2 将依赖于您的项目。 Concretely you will have some javascript files added at installation ( npm install ) in your ROOT/node_module directory.具体来说,您将在安装 ( npm install ) 时在ROOT/node_module目录中添加一些 javascript 文件。

They will not be include in your NPM repo if you add a root file in your project named .npmignore with at least this content :如果您在名为.npmignore的项目中添加至少包含以下内容的根文件,它们将不会包含在您的 NPM 存储库中:

node_modules

You can do the same for your GIT repository and a file named .gitignore with at least this content :您可以对您的 GIT 存储库和名为.gitignore的文件执行相同的操作,其中至少包含以下内容:

node_modules/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM