Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/smart-crabs-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': minor
---

feat: redact internal stack trace when reporting config errors
10 changes: 9 additions & 1 deletion packages/kit/src/core/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ export async function load_config({ cwd = process.cwd() } = {}) {

const config = await import(`${url.pathToFileURL(config_file).href}?ts=${Date.now()}`);

return process_config(config.default, { cwd });
try {
return process_config(config.default, { cwd });
} catch (e) {
const error = /** @type {Error} */ (e);

// redact the stack trace — it's not helpful to users
error.stack = `Could not load svelte.config.js: ${error.message}\n`;
throw error;
}
}

/**
Expand Down