-
-
Notifications
You must be signed in to change notification settings - Fork 116
feat: improve compile error reporting #220
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
Conversation
@benmccann please try it and let me know if that's good enough. We may be able to improve this further by additional handling in kit itself. |
I think this line needs to be updated as well:
Besides that, lgtm.
I'm curious what we might do on the kit side? |
compile errors are handled for esbuild now too (differently than for vite because it has a different reporting format).
|
i'm having a hard time provoking an error that triggers the esbuild error handling changed in this PR. |
…es a more compact/readable output on error
finally was able to trigger it thanks to @bluwy . this is how esbuild prebundling errors will be displayed (cli only) > e2e-tests-configfile-esm@1.0.0 dev /home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/e2e-tests/configfile-esm
> vite
> ../_test_dependencies/svelte-src-export/src/components/Dependency.svelte:3:5: error: [plugin: vite-plugin-svelte:optimize-svelte] /home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/e2e-tests/_test_dependencies/svelte-src-export/src/components/Dependency.svelte:3:5 Unexpected token
3 │ foo(;
╵ ^
html:/home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/e2e-tests/configfile-esm/src/App.svelte:23:23: note: The plugin "vite-plugin-svelte:optimize-svelte" was triggered by this import
23 │ import Dependency from 'e2e-test-dep-svelte-src-export/src/components/Dependency.svelte';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The link to the file with the error is clickable in intellij idea (and i hope in vscode too) These esbuild errors should be rare though as the .svelte files are published in a library and hopefully the library maintainers are thoughtful enough to not publish erroneous .svelte files. vite devserver cli shows this 3:37:14 PM [vite] Internal server error: /home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/kit-demo-app/src/lib/Counter/index.svelte:14:5 Unexpected token
Plugin: vite-plugin-svelte
File: /home/dominikg/develop/sveltejs/vite-plugin-svelte/packages/playground/kit-demo-app/src/lib/Counter/index.svelte
12 | return ((n % m) + m) % m;
13 | }
14 | foo(;
^
15 | </script>
16 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some format nitpicks
Co-authored-by: Bjorn Lu <34116392+bluwy@users.noreply.github.com>
convert compiler error to a RollupError that is displayed to the user in a more friendly way than the current stack pointing into vite-plugin-svelte.
This is a bit verbose and causes messages to be sent multiple times on console for sveltekit (ssr and regular compile) but at least it's showing the correct file and frame.
fixes #218