Merge pull request #2658 from matrix-org/bwindels/moarcachebustin

Cache-bust languages.json with file-loader
pull/21833/head
Bruno Windels 2019-02-20 13:34:42 +01:00 committed by GitHub
commit 6455334bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,9 @@ module.exports = {
"flowtype",
"babel"
],
globals: {
LANGUAGES_FILE: "readonly",
},
env: {
es6: true,
},

View File

@ -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
npm run build
RIOT_LANGUAGES_FILE="../riot-web/webapp/i18n/languages.json" npm run build
popd

View File

@ -338,8 +338,10 @@ 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');
request(
{ method: "GET", url: i18nFolder + 'languages.json' },
{ method: "GET", url },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
reject({err: err, response: response});