Angular 6.0 firebase 托管部署不起作用

标签 angular firebase-hosting firebase-tools

我正在寻找有关如何在我的 Angular 6.0 项目上正确设置 firebase-tools 托管的教程,我发现的总是这样。

- firebase init 
- then select the Hosting
- What do you want to use as your public directory? dist
- Configure as a single-page app (rewrite all urls to /index.html)? Yes
- Overwrite? No
- ng build --prod
- firebase deploy

但在这样做之后,这就是我所拥有的。

default

最佳答案

我发现 ng build --prod 会在项目位置下创建一个 dist 和另一个子文件夹。

dist
|--TheProject_Folder
|  |--assets|index.html - This index html is not using.
|--index.html - This is the html generated in the firebase init

所以我所做的是再次初始化 firebase init 并将 public 目录dist 更改为 dist/TheProject_Folder:

- What do you want to use as your public directory? dist/TheProject_Folder
- Configure as a single-page app (rewrite all urls to /index.html)? Yes
- Overwrite? No

关于Angular 6.0 firebase 托管部署不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50360477/

相关文章:

firebase - 如何在 firebase 托管的 webapp 中获取 firebase 函数 URL?

firebase - 在没有互联网连接的情况下使用 Firebase 模拟器

node.js - 使用在 Firestore 模拟器上运行的 Firebase-Admin 时找不到 Firestore 文档

javascript - 使用 RXJS lib 在 Angular 中,当浏览器选项卡处于非事件状态时暂停间隔订阅,并在选项卡处于事件状态时恢复订阅

angular - 重构 switch 语句以降低代码复杂度

android - Android 4.4 上的 Firebase 托管 SSL 握手异常

html - Firebase 没有运行 index.html 文件

javascript - 从 API 获取数据( Angular )

angular - 迭代 Angular 2+ FormArray

Firebase 托管的字体总是返回 404