fix: make Gatsby wait for challenges to be sourced
This commit is contained in:
committed by
mrugesh
parent
0124e7556d
commit
58973be7be
@ -32,7 +32,7 @@ exports.sourceNodes = function sourceChallengesSourceNodes(
|
|||||||
usePolling: true
|
usePolling: true
|
||||||
});
|
});
|
||||||
|
|
||||||
watcher.on('ready', sourceAndCreateNodes).on('change', filePath =>
|
watcher.on('change', filePath =>
|
||||||
/\.md$/.test(filePath)
|
/\.md$/.test(filePath)
|
||||||
? onSourceChange(filePath)
|
? onSourceChange(filePath)
|
||||||
.then(challenge => {
|
.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));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user