Skip to content

Svelte 5: runes-mode compiler validation errors throw "undefined" #13893

@zuckschwerdt

Description

@zuckschwerdt

Describe the bug

I just noticed that any plain on…="…" attributes (e.g. onclick="…") in component html will break the build if there are still deprecated on:… (e.g. on:click="…") attributes present in the same file, but with an obscure error message:

error during build:
undefined

A fix of course is to only use exclusively the new or deprecated syntax -- but I guess there is some compiler problem or at least an opportunity for a better error message :)

This might be a fix for #13883.

Reproduction

$ npm create vite@latest
✔ Select a framework: › Svelte
✔ Select a variant: › JavaScript

$ npm install
$ npm run build

vite v5.4.10 building for production...
…
✓ built in 174ms

# Add any on-attribute, e.g.
$ vi src/App.svelte
<div onclick={() => console.log('hi')}>

$ npm run build

vite v5.4.10 building for production...
✓ 51 modules transformed.
x Build failed in 84ms
error during build:
undefined

Logs

see reproduction

System Info

Node: 22.8.0
npm: 10.8.2

@sveltejs/vite-plugin-svelte: 4.0.0
svelte: 5.1.1
vite: 5.4.10

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions