sveltejs / kit

web development, streamlined
https://svelte.dev/docs/kit
MIT License
18.76k stars 1.95k forks source link

nicer error logging #11291

Open Rich-Harris opened 11 months ago

Rich-Harris commented 11 months ago

Describe the problem

errors encountered during build (e.g. when reading config, or when a page fails to render) are kinda ugly. pretty sure we could make them way nicer quite easily

Describe the proposed solution

nicer errors

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

dummdidumm commented 11 months ago

Ugly in what sense? And what would make them nicer?

Rich-Harris commented 11 months ago

Stuff like this:

image

Showing a stack trace that is purely internal SvelteKit stuff is totally unnecessary — the user can't do anything with it, we should just print a bold red message.

dummdidumm commented 11 months ago

For certain errors like the options validation that makes sense, for others having the stack trace - even if it leads into internals - is very helpful. You get something to start at.

brunnerh commented 2 months ago

Stack trace aside, the path to the file causing the build error should be printed. The messages can be rather useless sometimes, e.g.

CompileError: Block was left open

This could be anywhere.

Broke something among dozens of components and had to start the build itself in debug mode to find out which component was actually responsible (via a breakpoint in compileSvelte within the Vite plugin).

Looks like svelte-check can help out as well, it points to the file and shows the exact location. The build output should ideally do the same.