Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show errors in dev server #1547

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 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,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(output);
}
});

} else {
child.on('close', () => {
resolve({ child, output });
Expand Down
Loading