sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
79.3k stars 4.18k forks source link

Unexpected character @ #13856

Closed DDuran19 closed 4 hours ago

DDuran19 commented 5 hours ago

Describe the bug

{6898B43E-7E3A-47F0-A9DE-2ED39A75FFCC}

I am getting this error Unexpected character '@'svelte(parse-error) when using @render I am not sure if this is svelte5 problem or probably my IDE, or extension? please help...

Reproduction


<script lang="ts">
    import NewOrder from './this/NewOrder.svelte';
    import { newOrderModal } from './this/stores';

    let { data, children } = $props();
    const branches = data.branches;
</script>

{#if branches && branches.length !== 0}
    <NewOrder {branches} />
{/if}
{#if children}
    {@render children()}
{/if}

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i3-10105 CPU @ 3.70GHz     
    Memory: 647.48 MB / 7.83 GB
  Binaries:
    Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (130.0.2849.52)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    svelte: ^5.1.0 => 5.1.0

Severity

annoyance

jasonlyu123 commented 5 hours ago

This is most likely because you updated from Svelte 4 to Svelte 5 and the language server still has the cache from loading the Svelte 4. In that case, just restart the editor. Another possibility is that you have workspace trust set to untrust. In that case, the local Svelte 5 compiler won't be loaded and you'll have to trust the workspace for it to work.

DDuran19 commented 4 hours ago

Yes, that's exactly what I did, I updated from svelte 4 to svelte 5 (restarting editor didn't work tho, maybe I will need to delete some stuff) Thanks for this, I will do your suggestion later, but will mark this as closed. thanks man @jasonlyu123