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

Cache-bust languages.json with file-loader
This commit is contained in:
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", "flowtype",
"babel" "babel"
], ],
globals: {
LANGUAGES_FILE: "readonly",
},
env: { env: {
es6: true, 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 rm -r node_modules/matrix-react-sdk
ln -s "$REACT_SDK_DIR" 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 popd

View file

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