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

Surface frame on failed Svelte compilation #76

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

benmccann
Copy link
Collaborator

When Svelte compiles a template, if it encounters an error in that template it attaches a frame variable to the exception showing where the error occurred.

Currently there's a bug in svelte-preprocess 4.9.0-4.9.4 which causes an invalid template and it was very difficult to figure out why. Had we surfaced the frame this would be much easier to figure out and would print:

      The $ prefix is reserved, and cannot be used for variable and import names
      3: exports.name = void 0;
      4: exports.name = "";
      5: var $$$$$$$$ = null;
         ^
      6: var $$vars$$ = [exports.name];</script>
      7: 

The svelte-preprocess case is a bit of a weird one. But you could imagine that the user had instead written their template in an invalid way. If this were the case it could be very difficult to figure out without this information. Probably they'd find out when building their project, but if they were trying to run the tests without rebuilding the project it could take them quite awhile to figure out what the issue is until they went to rebuild

@sebastianrothe sebastianrothe merged commit 08658d5 into svelteness:master Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants