diff --git a/src/main.ts b/src/main.ts index 92ee267bf65..b6103c48115 100644 --- a/src/main.ts +++ b/src/main.ts @@ -43,6 +43,7 @@ Phaser.GameObjects.Rectangle.prototype.setPositionRelative = setPositionRelative document.fonts.load("16px emerald").then(() => document.fonts.load("10px pkmnems")); let game; +let manifest; const startGame = async () => { await initI18n(); @@ -94,15 +95,19 @@ const startGame = async () => { version: version }); game.sound.pauseOnBlur = false; + if (manifest) { + game["manifest"] = manifest; + } }; fetch("/manifest.json") .then(res => res.json()) .then(jsonResponse => { - startGame(); - game["manifest"] = jsonResponse.manifest; - }).catch(() => { - // Manifest not found (likely local build) + manifest = jsonResponse.manifest; + }).catch(err => { + // Manifest not found (likely local build or error path on live) + console.log(`Manifest not found. ${err}`); + }).finally(() => { startGame(); }); diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index d24484bbf9d..91a67b9414c 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -164,7 +164,7 @@ export async function initI18n(): Promise { } else { fileName = camelCaseToKebabCase(ns); } - return `/locales/${lng}/${fileName}.json?v=${pkg.version}`; + return `./locales/${lng}/${fileName}.json?v=${pkg.version}`; }, }, defaultNS: "menu",