Skip to content

Commit

Permalink
Handle empty config files (#1203)
Browse files Browse the repository at this point in the history
* handle empty config && asset files

* remove bad empty asset solution
  • Loading branch information
Jasper De Moor authored and devongovett committed Apr 24, 2018
1 parent 7a2ba16 commit 11a7882
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ async function load(filepath, filenames, root = path.parse(filepath).root) {
return require(configFile);
}

let configStream = await fs.readFile(configFile);
let configContent = (await fs.readFile(configFile)).toString();
let parse = PARSERS[extname] || PARSERS.json;
return parse(configStream.toString());
return configContent ? parse(configContent) : null;
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND' || err.code === 'ENOENT') {
existsCache.delete(configFile);
Expand Down

0 comments on commit 11a7882

Please sign in to comment.