From 5f247f7962bbdb9d1bcb58ae46a0b2baef8306d6 Mon Sep 17 00:00:00 2001 From: konnorrogers Date: Tue, 29 Aug 2023 17:03:10 -0400 Subject: [PATCH] show errors in dev server --- scripts/build.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/build.js b/scripts/build.js index e46f4ef9b..fa29ad5e9 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -34,6 +34,9 @@ const shoelaceVersion = JSON.stringify(packageData.version.toString()); async function buildTheDocs(watch = false) { return new Promise(async (resolve, reject) => { const afterSignal = '[eleventy.after]'; + + // Totally non-scientific way to handle errors. Perhaps its just better to resolve on stderr? :shrug: + const errorSignal = 'Original error stack trace:' const args = ['@11ty/eleventy', '--quiet']; const output = []; @@ -65,6 +68,14 @@ async function buildTheDocs(watch = false) { resolve({ child, output }); } }); + + child.stderr.on('data', data => { + if (data.includes(errorSignal)) { + // This closes the dev server, not sure if thats what we want? + reject(child); + } + }); + } else { child.on('close', () => { resolve({ child, output });