【问题标题】:Deploying Quasar with Firebase Hosting使用 Firebase 托管部署 Quasar
【发布时间】:2020-10-26 20:45:30
【问题描述】:

我在将 quasar 项目部署到 Firebase 时遇到问题。它说部署成功,但是两个小时后,这就是网页上显示的内容。

firebase.json

"hosting": {
   "public": "dist/spa",
   "ignore": [
     "firebase.json",
     "**/.*",
     "**/node_modules/**"
   ],
   "rewrites": [
     {
       "source": "**",
       "destination": "/index.html"
     }
   ]

routes.js


const routes = [
  {
    path: '/',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      { path: '', component: () => import('pages/PageUsers.vue') },
      { path: '/chat/:otherUserId', component: () => import('pages/PageChat.vue') },
      { path: '/auth', component: () => import('pages/AuthPage.vue') }

    ]
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '*',
    component: () => import('pages/Error404.vue')
  }
]

export default routes

我首先运行 quasar build,然后运行 ​​firebase init,然后运行 ​​firebase deploy,但网站上还没有任何显示。关于为什么会发生这种情况的任何想法?

更新:现在同一页面显示在 http://localhost:8080/ 而不是我的项目上

【问题讨论】:

    标签: firebase vue.js firebase-hosting quasar-framework quasar


    【解决方案1】:

    如果您先构建,“firebase init”将覆盖您的 index.html。

    1. Firebase 初始化
    2. 运行类星体构建
    3. Firebase 部署

    你试过这个顺序吗?

    我也遇到了同样的问题,但是在我更改了订单后,它就照常工作了。

    【讨论】:

      【解决方案2】:

      我在使用 Firebase 托管设置 Quasar 项目时遇到了同样的问题。 我注意到的一件事是在public 文件夹内的firebase 初始化期间生成了一个新的index.html。 删除public/index.html后,原索引页正常显示。

      解决方案:

      • 检查public文件夹中是否生成了index.html文件
      • 删除文件

      【讨论】:

        【解决方案3】:

        这是因为 Firebase 正在用自己的 index.html 覆盖您的 index.html,以解决该问题:

        1. 运行quasar build -m spa 生成正确的index.html

        2. 运行firebase init,当它要求您覆盖 index.html 时,请选择“否”,如下所示:

        3. 运行firebase deploy

        【讨论】:

          猜你喜欢
          • 2018-11-08
          • 2020-12-25
          • 2015-04-18
          • 1970-01-01
          • 2020-01-14
          • 2020-02-27
          • 2021-05-09
          • 1970-01-01
          • 2017-01-22
          相关资源
          最近更新 更多