From a97e68289ed97acff964df373f58672409397aec Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 23 Apr 2021 18:19:05 +0200 Subject: [PATCH] Prevent nodemon infinite loop on yarn dev after yarn clean --- scripts/prepare-sources.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/prepare-sources.js b/scripts/prepare-sources.js index a78c2f3..2dc7715 100644 --- a/scripts/prepare-sources.js +++ b/scripts/prepare-sources.js @@ -2,3 +2,11 @@ const fs = require('fs'); const path = require('path'); fs.copyFileSync('package.json', path.join('src', 'package.json')); + +// These dir must exist for nodemon not to loop indefinitely. +[ + 'build', + 'public', +].forEach(dir => { + if (!fs.existsSync(dir)) fs.mkdirSync(dir); +});