From 63c6f600bf4f46c2aaa867d5fd47e99dd70fbd24 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 11:30:50 +0000 Subject: [PATCH] Use webpack alias to resolve the languages file Hopefully this will end up simpler than having to figure out in riot-web what the relative path is from react-sdk's src/languageHandler.js to riot-web's webapp directory. --- scripts/travis/build.sh | 2 +- src/languageHandler.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index df192d70b2..a353e38a06 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -23,5 +23,5 @@ ln -s "$REACT_SDK_DIR/node_modules/matrix-js-sdk" node_modules/matrix-js-sdk rm -r node_modules/matrix-react-sdk ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk -RIOT_LANGUAGES_FILE="../riot-web/webapp/i18n/languages.json" npm run build +npm run build popd diff --git a/src/languageHandler.js b/src/languageHandler.js index 7c1a47fed9..bc2bd429b5 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -338,8 +338,8 @@ export function getCurrentLanguage() { function getLangsJson() { return new Promise((resolve, reject) => { - // LANGUAGES_FILE is a webpack compile-time define, see webpack config - const url = (typeof LANGUAGES_FILE === "string") ? require(LANGUAGES_FILE) : (i18nFolder + 'languages.json'); + // Webapp is a webpack resolve alias pointing to the output directory, see webpack config + const url = require('Webapp/i18n/languages.json'); request( { method: "GET", url }, (err, response, body) => {