繁体   English   中英

制作Angular2项目

[英]Production of Angular2 project

这是我的第一个angular2项目制作。 我从这个站点使用了这个答案。 带有Angular CLI 1.0.0-beta.24的2.4.x FINAL(TypeScript)

一次性设置

npm install -g angular-cli

ng init从projectFolder如果它是一个现有的应用程序纳克新projectFolder如果它是一个新的应用程序。

捆绑步骤

ng build --prod --aot (在目录为projectFolder时在命令行中运行)将生产的prod软件包标记为生产,并且标记aot启用提前编译,也称为脱机编译。

捆绑包默认生成为projectFolder / dist /

输出量

dist/main.[hash].bundle.js Your application bundled [ size: 13 KB for new Angular CLI application empty, ~3 KB compressed].
dist/vendor.[hash].bundle.js Your dependencies (@angular, RxJS...) bundled [ size: 437 KB for new Angular CLI application empty, 98 KB compressed].
dist/index.html entry point of your application.
dist/inline.js webpack loader
dist/style.[hash].bundle.css the style definitions
dist/assetsresources copied from projectFolder/src/assets
dist/*.[hash].bundle.map the SourceMaps corresponding to the previous files (it is not required for a production deployment)

但是,当我单击dist / index.html时,我仅接收到加载...而没有其他任何接收。 如何获得正式版?

您无法通过双击index.html打开/引导Angular2项目。 您需要后端服务器(nodejs,lite服务器)或部署服务器(托管站点,如托管服务器或Apache Tomcat服务器)。

官方文档在这里

暂无
暂无

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

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