Fix error-codes not updating correctly (#10348)

* Fix error-codes not updating correctly

* Revert changes to codes.json
This commit is contained in:
Michał Pierzchała
2017-08-02 11:38:27 +02:00
committed by Dan Abramov
parent c5d1558a5b
commit 73217a74a0
2 changed files with 59 additions and 54 deletions
+9 -4
View File
@@ -40,10 +40,15 @@ module.exports = function(opts) {
var errorMapFilePath = opts.errorMapFilePath;
var existingErrorMap;
try {
existingErrorMap = require(path.join(
__dirname,
path.basename(errorMapFilePath)
));
// Using `fs.readFileSync` instead of `require` here, because `require()`
// calls are cached, and the cache map is not properly invalidated after
// file changes.
existingErrorMap = JSON.parse(
fs.readFileSync(
path.join(__dirname, path.basename(errorMapFilePath)),
'utf8'
)
);
} catch (e) {
existingErrorMap = {};
}