Facebookのインスタントゲームをセットアップしようとしています。
https://developers.facebook.com/docs/games/instant-games/test-publish-shareに従って、ローカルでテストしてから本番環境にデプロイしました。
テストすると、すべて正常に動作します。ただし、本番環境では、ゲームを開いたときに何も表示されません (黒い画面)。<app-root>
app-home のコンストラクターは呼び出されず、0x0 ピクセルを占有します。
これは私のindex.htmlです
<!--
Copyright (c) 2017-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="yes" />
<meta name="screen-orientation" content="portrait" />
<meta name="viewport" content="user-scalable=no" />
<script type="module" src="/build/app.esm.js"></script>
<script nomodule src="/build/app.js"></script>
<link href="/build/app.css" rel="stylesheet">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icon/apple-touch-icon.png">
<link rel="icon" type="image/x-icon" href="/assets/icon/favicon.ico">
<link rel="manifest" href="/manifest.json">
</head>
<body>
<script src="https://connect.facebook.net/en_US/fbinstant.6.2.js"></script>
<script type="text/javascript">
const assets = [
'img/asset1.png',
'img/asset2.png',
'img/asset3.png',
'img/asset4.png'
];
window.onload = function () {
// When the window loads, start to initialize the SDK
FBInstant.initializeAsync().then(function () {
// We can start to load assets
for (let i in assets) {
// When preloading assets, make sure to report the progress
FBInstant.setLoadingProgress(i / assets.length * 100);
}
// Now that assets are loaded, call startGameAsync
FBInstant.startGameAsync().then(() => console.log("initialized"));
});
};
</script>
<app-root></app-root>
</body>
</html>
ゲームを開くと、コンソールに「initialized」と表示されます。そこには2つのエラーがあります(これは私が抱えているエラーに関係している可能性があります) コンソールログ
404 エラー (リソースが見つかりません) は、アップロードした .zip ファイルに含まれていることを確認した .js ファイルです。
これは、ゲームの要素を検査したときに表示されるものです Inspect 要素
また、モバイルでは何も表示されない(白画面)
どんな助けでも大歓迎です。ありがとう!:)