-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Revert "chore: CompileDiagnostic no longer extends Error" #13937
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
This reverts commit 894b1c3.
|
commit: |
Can't this be solved in |
Hmm, that's tricky. I think if we solved it in The same might be true for |
The stack can't be generated while in the plugin and if we don't extend Error or add the stack from an error it will not have the right positions. I think we should do this and fix the worker thing (which btw i'm pretty sure it happened before and i fixed it in some PR...let me see if i can find it). |
This is how i fixed it before: #12394 imho we should do the same now |
What I mean is that the stack is useless here. We don't need it, so can we provide an empty stack instead to make this work? |
The stack might not be useful but without the stack it doesn't even print the frame and the actual error (and i think it's actually vite that is displaying this stuff). Considering the playground is fixable and the Diagnostic is an Error indeed i would fix this here and fix the playground too (i'm actually about to open a simiilar PR on svelte.dev |
I mean having an empty stack might convince Vite that it's an error and thus print the error message, even though it's not an error? |
It does...ok let me close this and open a new one to add a stack property on CompileDiagnostic! |
Reverts #13651
Closes #13933 (at least aprtially).
The PR was to allow the Error to be passed via
postMessage
from the Worker in the playground...but this caused the issue in #13933 becausevite-plugin-svelte
throw the error after converting it to aRollupError
and it's showing the stack when the build fails.We can find another way to make this work cross Worker but i think we should revert this PR in the meantime.
Output before:
Output after:
Another option could be to generate a stack and add a stack property on the element like this
but this feels a bit weird (it would solve the error in the playground (because it doesn't extend Error anymore) while keeping a good looking error if we fail on build (although i wonder if the reason postmessage was failing was because of the stack property that maybe adds too much stuff...i don't know).