フラッター Web プロジェクトを作成し、localhost で正常に動作しました。そこで、firebase で Web サイトをホストすることを計画しました。正常にデプロイされたコマンドに従いましたが、コンソールに黒い画面しか表示されず、エラーメッセージが表示されます。
エラー :
ソース「<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
}
]
}
}
コマンド:
注: public dir を public フォルダーとして指定すると、index.html が作成されます。ファイルを手動で削除し、web/index.html としてパスに移動します。