Skip to content

Commit 16961e8

Browse files
authored
fix: adjust missing inner content warning (#11394)
1 parent 9da6508 commit 16961e8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/giant-planets-sing.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sveltejs/kit": patch
3+
---
4+
5+
fix: adjust missing inner content warning

packages/kit/src/exports/vite/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ const warning_preprocessor = {
105105
if (!filename) return;
106106

107107
const basename = path.basename(filename);
108-
if (basename.startsWith('+layout.') && !content.includes('<slot')) {
108+
const has_children =
109+
content.includes('<slot') || (isSvelte5Plus() && content.includes('{@render'));
110+
111+
if (basename.startsWith('+layout.') && !has_children) {
109112
const message =
110113
`\n${colors.bold().red(path.relative('.', filename))}\n` +
111-
'`<slot />` missing — inner content will not be rendered';
114+
`\`<slot />\`${isSvelte5Plus() ? ' or `{@render ...}` tag' : ''}` +
115+
' missing — inner content will not be rendered';
112116

113117
if (!warned.has(message)) {
114118
console.log(message);

0 commit comments

Comments
 (0)