我创建了一个颤振的 Web 项目并在 localhost 中正常工作。所以我计划在firebase中托管网站。我遵循了它成功部署的命令,但它在控制台中只显示黑屏并显示错误消息。
错误 :
源代码“<a href="https://myportfolioflutterweb.firebaseapp.com/web/main.dart.js" rel="nofollow noreferrer">https://myportfolioflutterweb.firebaseapp.com/web/main 加载失败.dart.js”。SyntaxError: 预期的表达式,得到 '<'[了解更多]
我的项目结构:
firebase.json :
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [
{
"source": "/",
"destination": "/web/index.html",
"type": 302
}
]
}
}
命令:
注意:当我将公共目录作为公共文件夹时,它会创建 index.html。我手动删除了文件并导航到 web/index.html 的路径