Skip to content

Commit

Permalink
fix: 🐛 Fix dependency to build.js in urlParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdeněk Laštůvka committed Jan 18, 2022
1 parent 3e2ee88 commit 604d05a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/server/lib/urlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { URL } = require('url');
let path = require('path');
let applicationFolder = path.resolve('.');

const BUILD_JS_PATH = path.resolve(applicationFolder, './app/build.js');
const IMA_CONFIG_JS_PATH = path.resolve(applicationFolder, './ima.config.js');

module.exports = environment => {
function _getHost(req) {
Expand Down Expand Up @@ -34,9 +34,11 @@ module.exports = environment => {
rootExpression.replace('/', '/');

if (languageParam) {
let build = require(BUILD_JS_PATH) || {};
let imaConfig = require(IMA_CONFIG_JS_PATH) || {
languages: { cs: [], en: [] }
};

const langCodes = Object.keys(build.languages);
const langCodes = Object.keys(imaConfig.languages);
let languagesExpr = langCodes.join('|');
rootReg += '(/(' + languagesExpr + '))?';
}
Expand Down

0 comments on commit 604d05a

Please sign in to comment.