Firebase托管400错误请求
我正在尝试为我的项目设置firebase主机。我已经部署到 我正在使用vue.js框架构建我的应用程序,以便在我的公用文件夹中有一个index.html文件。所有vue内容都将加载到要渲染的文件中。在localhost上一切正常,但当我尝试在Firebase上托管站点时,不会加载任何vue内容。如果我将内容直接写入index.html文件,它将加载,这解释了页面标题的工作原理。有没有办法解决这个问题 web\u app/firebase.jsonFirebase托管400错误请求,firebase,vue.js,firebase-hosting,Firebase,Vue.js,Firebase Hosting,我正在尝试为我的项目设置firebase主机。我已经部署到 我正在使用vue.js框架构建我的应用程序,以便在我的公用文件夹中有一个index.html文件。所有vue内容都将加载到要渲染的文件中。在localhost上一切正常,但当我尝试在Firebase上托管站点时,不会加载任何vue内容。如果我将内容直接写入index.html文件,它将加载,这解释了页面标题的工作原理。有没有办法解决这个问题 web\u app/firebase.json { "firestore": {
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "storage.rules"
}
}
web\u app/public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>Budyeez</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
<script src="https://kit.fontawesome.com/3797ae5e09.js" crossorigin="anonymous"></script>
</head>
<body>
<h3>This is a test</h3>
<noscript>
<strong>We're sorry but web_app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
布迪耶兹
这是一个测试
很抱歉,没有启用JavaScript,web_应用程序无法正常工作。请使其继续。
将您的firebase.json
更新为以下内容(编辑我的评论):
{
“firestore”:{
“规则”:“firestore.rules”,
“索引”:“firestore.indexes.json”
},
“职能”:{
“部署前”:[
“npm--前缀\$RESOURCE\u DIR\“run lint”
]
},
“托管”:{
“公共”:“地区”,//我们需要确切地知道您的公用文件夹是什么样子,您发出请求的确切程度,以及在完成该文件夹的部署后,您希望给定URL做什么。我的公用文件夹包含index.html文件夹。我正在构建一个vue.js应用程序,以便vue将所有内容加载到index.html中。没有vue内容正在加载到页面中,但如果我直接在index.html文件中写入内容,它将呈现在页面上。当我运行npm时,服务一切正常。此问题特别是在尝试使用firebase托管时。请编辑问题以包含您的所有观察结果(不要仅添加注释)。我们需要查看足够的信息,包括所有相关代码,以便能够完全按照您看到的内容重现问题。请阅读:抱歉,这是我的第一篇帖子。这是怎么回事?
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
},
"hosting": {
"public": "dist", // <-- CHANGED: hosting deploy directory to Vue's build directory
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"predeploy": [
"npm run build" // <-- CHANGED: Before deploying, automatically build Vue project
]
},
"storage": {
"rules": "storage.rules"
}
}