fix: make Gatsby wait for challenges to be sourced

This commit is contained in:
Oliver Eyton-Williams
2019-07-25 13:56:58 +02:00
committed by mrugesh
parent 0124e7556d
commit 58973be7be

View File

@ -32,7 +32,7 @@ exports.sourceNodes = function sourceChallengesSourceNodes(
usePolling: true
});
watcher.on('ready', sourceAndCreateNodes).on('change', filePath =>
watcher.on('change', filePath =>
/\.md$/.test(filePath)
? onSourceChange(filePath)
.then(challenge => {
@ -73,4 +73,8 @@ File changed at ${filePath}, replacing challengeNode id ${challenge.id}
`)
);
}
return new Promise((resolve, reject) => {
watcher.on('ready', () => sourceAndCreateNodes().then(resolve, reject));
});
};