簡體   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