【问题标题】:Ionic2 PWA + Firebase Hosting not workingIonic2 PWA + Firebase 托管不工作
【发布时间】:2017-06-02 09:26:12
【问题描述】:

我尝试在 Firebase 托管上将 Ionic2 应用程序作为 PWA 托管 - 但它不起作用。

ionic build --prod browser

然后我在platforms/browser目录中初始化firebase项目

firebase init

然后我上传应用程序

firebase deploy

但是还是不行。

我总是得到这个页面:

【问题讨论】:

  • 尝试覆盖在 init 阶段创建的索引 html。如related SO post 中所述,index.html 文件是使用模板化的“欢迎...”消息创建的。 AFAIK,如果部署时有索引文件,这将提示并询问您是否同意覆盖。这可以通过将模板化的 html 替换为您自己的 html 文件来轻松解决。希望这会有所帮助。
  • 谢谢 - 这不是问题。但是根据您的提示,我发现了问题。

标签: firebase ionic2 firebase-hosting progressive-web-apps


【解决方案1】:

我的错误发生在第 2 步。我根据一些 Angular 教程选择 dist 作为公共目录。

解决方案

步骤 1

在你的 ma​​in 目录中初始化 firebase

firebase init

第二步

您想将什么用作公共目录? www

第三步

配置为单页应用(将所有 url 重写为 /index.html)? 是的

第四步

文件 www/index.html 已经存在。覆盖? 没有

第 5 步

ionic build --prod

第 6 步

firebase deploy

【讨论】:

    猜你喜欢
    • 2018-08-29
    • 2019-01-16
    • 2017-03-28
    • 2021-04-17
    • 1970-01-01
    • 1970-01-01
    • 2021-05-07
    • 2020-08-13
    • 2019-12-03
    相关资源
    最近更新 更多