When using an empty <title> tag in <svelte:head> a client error will be thrown.
To reproduce add this in routes/index.svelte:
<svelte:head>
<title></title>
</svelte:head>
The error is: Cannot read property 'data' of undefined.
When trying to build the full stack trace is visible (hidden in dev mode):
TypeError: Cannot read property 'data' of undefined
at TitleWrapper.render (project/node_modules/svelte/compiler.js:17301:60)
at FragmentWrapper.render (project/node_modules/svelte/compiler.js:17540:28)
at HeadWrapper.render (project/node_modules/svelte/compiler.js:16270:24)
at FragmentWrapper.render (project/node_modules/svelte/compiler.js:17540:28)
at new Renderer (project/node_modules/svelte/compiler.js:17571:24)
at dom (project/node_modules/svelte/compiler.js:17762:23)
at compile (project/node_modules/svelte/compiler.js:23767:16)
at preprocessPromise.then.code (project/node_modules/rollup-plugin-svelte/index.js:236:22)
This is confusing when an empty title tag is used (when starting a new project and leaving it empty as a placeholder), as the error is not helpful. Adding content inside the tag will work just fine.
(useless comment): same here, I was on the point to open the same issue :)
OK but why not just leave the title off or bind it to something?
OK but why not just leave the title off or bind it to something?
I think it should not crash at all to be honest, an empty title tag is valid, no framework should reinterpret html.
But if it does crash because of this, it should at least throw an error that explains the issue is the empty tag. Otherwise we have people all over the world debugging this over and over again, and putting the head section with an empty title as placeholder for later modification is not uncommon.
This is actually a Svelte bug - I've transferred the issue.