在Firebase上为Vue JS 2 App配置主机

时间:2018-09-01 04:23:55

标签: firebase vuejs2 firebase-hosting

我已经在Google Firebase上部署了单页vue js Web应用程序。当请求源文件时,firebase返回index.html而不是应用程序需要运行的.js文件。我尝试重新配置Web应用程序的重写

旧的,将所有请求都匹配到index.html:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 158
Model name:            Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
...

新功能,旨在将所有 文件请求与index.html匹配:

"rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]

现在,每当我转到js文件的链接时,都会收到404错误。 有什么想法吗?

1 个答案:

答案 0 :(得分:0)

好吧,经过许多小时的努力,我发现解决方案是将Firebase CLI从4.1.0升级到4.1.1