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

Better handling of preprocess errors #259

Closed
benmccann opened this issue Jan 26, 2022 · 3 comments
Closed

Better handling of preprocess errors #259

benmccann opened this issue Jan 26, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@benmccann
Copy link
Member

Describe the problem

I was getting the error message:

[vite-plugin-svelte] Cannot read property 'split' of undefined
file: src/routes/__layout.svelte
Cannot read property 'split' of undefined

This was impossible to track down.

This turned out to be a bug in svelte-preprocess that appears to have been recently fixed. It happens if you have svelte-preprocess 4.9.0 with the following code:

<script lang="ts" context="module">
</script>
<script>
</script>

Here's a commit where it was happening: svelte-society/sveltesociety.dev@78cdfa1. You can reproduce with npm run build

Describe the proposed solution

It would be really nice to get a stack trace. I'm not sure why that was being swallowed and I was just getting the error message

Alternatives considered

We could put a try / catch around the call to preprocess to at least make it clear that's where it's coming from. svelte core could also do some type of reporting when a preprocessor fails. Neither solution would be as helpful as a stack trace though

Importance

would make my life easier

@benmccann benmccann added enhancement New feature or request triage Awaiting triage by a project member labels Jan 26, 2022
@dominikg
Copy link
Member

We missed this when we implemented #218

I'll look into converting preprocessor errors in the same way. Let's hope there is frame info available

@dominikg dominikg removed the triage Awaiting triage by a project member label Jan 27, 2022
@benmccann
Copy link
Member Author

There wouldn't be a frame in this particular case because that's something the Svelte compiler has to explicitly add and this was an unexpected error from a bug in svelte-preprocess. Maybe if there was a syntax error or something though

@dominikg
Copy link
Member

fixed in 1.0.0-next.36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants