【发布时间】:2016-10-26 18:55:07
【问题描述】:
我已经使用 Angular 2 CLI 构建了一个 Angular 2 应用程序。我现在的问题是,我想将应用程序部署到本地服务器作为登台环境供其他人查看。
大多数使用 Angular 2 CLI 的教程都显示了一个 dist 文件夹,该文件夹似乎是在首次使用 CLI 创建项目时生成的。我只能使用ng build 生成dist 文件夹。我假设 Angular 2 CLI 改变了最初 dist 文件夹是初始文件夹结构的一部分,但现在它只在使用 ng build 时生成?
作为测试,我将生成的dist文件夹复制到WAMP服务器[http://localhost:8080/Project/dist/]的www文件夹中,尝试运行应用程序...浏览器控制台显示:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/inline.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/bundle.js
它在本地服务器的根目录中查找所有资产,而不是将根目录设置为dist 文件夹中 index.html 的位置。所有图像和图标都有相同的问题...我想我未能为相对路径配置某些内容...我该怎么办?
【问题讨论】:
标签: angular deployment angular-cli