diff --git a/src/utils/rules-proxy.js b/src/utils/rules-proxy.js index d12a9af9615..6a81e95ad18 100644 --- a/src/utils/rules-proxy.js +++ b/src/utils/rules-proxy.js @@ -57,15 +57,11 @@ function getCountry(req) { module.exports = function createRewriter({ distDir, projectDir, jwtSecret, jwtRole, configPath }) { let matcher = null - const configFiles = Array.from( - new Set( - [ - path.resolve(distDir, '_redirects'), - path.resolve(projectDir, '_redirects'), - ] - .concat(configPath ? path.resolve(configPath) : []) - ) - ).filter(f => f !== projectDir && fs.existsSync(f)) + const configFiles = Array.from(new Set([ + path.resolve(configPath), + path.resolve(distDir, '_redirects'), + path.resolve(projectDir, '_redirects'), + ])).filter(f => fs.existsSync(f)) let rules = [] onChanges(configFiles, async () => {