Skip to content

Commit ce07992

Browse files
committed
fix: not loading languages of features that where just installed
1 parent 37cfe83 commit ce07992

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/features.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ const writeJsonFile = (filePath, data) => {
5555
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`);
5656
};
5757

58+
const invalidateLocalsMapCache = () => {
59+
delete require.cache[require.resolve(localsMapPath)];
60+
};
61+
5862
/**
5963
* Loads the route-to-translation-key map from config without using stale require cache data.
6064
* @returns {Object.<String, String[]>} The current locals map keyed by route path.
6165
*/
6266
const readLocalsMap = () => {
63-
delete require.cache[require.resolve(localsMapPath)];
67+
invalidateLocalsMapCache();
6468
return require(localsMapPath);
6569
};
6670

@@ -74,6 +78,7 @@ const writeLocalsMap = (localsMap) => {
7478
return result;
7579
}, {});
7680
fs.writeFileSync(localsMapPath, `module.exports = ${JSON.stringify(sortedMap, null, 4)}\n`);
81+
invalidateLocalsMapCache();
7782
};
7883

7984
/**

0 commit comments

Comments
 (0)