From 3eb3be45d18e6292c7bbddcae8cb1942d3a7b8a4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 20 Dec 2019 13:58:46 -0700 Subject: [PATCH] Fix import of language index This is a similar fix to https://github.com/matrix-org/matrix-react-sdk/pull/3766/commits/18ac2db2ea5c44de4153efbf133b8085ba613075 --- src/languageHandler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index c56e5378df..4aa22f3e65 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -410,11 +410,12 @@ export function pickBestLanguage(langs) { } function getLangsJson() { - return new Promise((resolve, reject) => { + return new Promise(async (resolve, reject) => { let url; try { // $webapp is a webpack resolve alias pointing to the output directory, see webpack config - url = require('$webapp/i18n/languages.json'); + url = import('$webapp/i18n/languages.json'); + if (url.then) url = (await url).default; // webpack resolves to a Module through a promise. } catch (e) { url = i18nFolder + 'languages.json'; }