Skip to content

Commit

Permalink
show errors in dev server (#1547)
Browse files Browse the repository at this point in the history
* show errors in dev server

* fix build

* prettier
  • Loading branch information
KonnorRogers authored Aug 30, 2023
1 parent a2fbe12 commit 883cb16
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -65,6 +68,13 @@ 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(output);
}
});
} else {
child.on('close', () => {
resolve({ child, output });
Expand Down

0 comments on commit 883cb16

Please sign in to comment.