日本語のWaySpotnameの対応方法(Lightship VPS Scavenger Hunt)

「Lightship VPS Scavenger Hunt」の「named-wayspot=“name: YOURWAYSPOTNAME”」のYOURWAYSPOTNAMEに日本語のWaySpot名を指定することができません.また,scenes以下にWaySpot名に合わせた日本語名のHTMLファイルも配置できません.

対応としてapp.js内に
const nameMapping = {
‘日本語のWaySpot名1’: ‘nihogo1’,
‘日本語のWaySpot名2’: ‘nihogo2’,
‘日本語のWaySpot名3’: ‘nihogo3’,
‘日本語のWaySpot名4’: ‘nihogo4’,
}
の追加と
window.addEventListener(‘startar’, ({detail}) => {
const mappedName = nameMapping[detail.name] || detail.name
swapBody(require(./scenes/${mappedName}.html))
window._startAR = detail
})
として日本語を英数文字に変換し,scenes以下のHTMLファイルも同様に変更しました.
vpsspot-meshes以下のファイル名も変更済みです.

しかし,実行すると以下のエラーが出てしまいます.
Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘t.constructor’)
Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘this.schema[n].schemaChange’)

その他,変更しなければならない個所や対応方法をご存じの方が居ましたらご助言頂けないでしょうか.
よろしくお願いします.

Hi, welcome to the forums!

Because filenames can’t have japanese characters but you can have Japanese characters in your code the workaround here is fairly simple. You’ll want to create a variable that will be a map between the Japanese location name and the HTML file you want to go to.

For example:

const locationsToScene = new Map();
map1.set('日本語のWaySpot名1', 'wayspot1.html');
map1.set('日本語のWaySpot名2', 'wayspot2.html');
map1.set('日本語のWaySpot名3', 'wayspot3.html');

Then when you want to switch to that scene you can get the file name by getting the value associated with the key:

window.addEventListener('startar', ({ detail }) => {
  const mappedName = locationsToScene.get(detail.name);
  
  if (mappedName) {
    swapBody(require(`./scenes/${mappedName}`));
    window._startAR = detail;
  } else {
    console.error(`No scene associated with ${detail.name}`);
  }
});