mirror of https://github.com/sveltejs/svelte
chore: add warning for invalid render function of createRawSnippet (#12535)
* chore: add warning for invalid render function of createRawSnippet * add test * warnings * Update packages/svelte/messages/client-warnings/warnings.md Co-authored-by: Rich Harris <rich.harris@vercel.com> * build * build * build --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12540/head
parent
2698716bdf
commit
518d9854f5
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: add warning for invalid render function of createRawSnippet
|
@ -0,0 +1,13 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
dev: true
|
||||||
|
},
|
||||||
|
|
||||||
|
skip_mode: ['hydrate'],
|
||||||
|
|
||||||
|
warnings: [
|
||||||
|
'The `render` function passed to `createRawSnippet` should return HTML for a single element'
|
||||||
|
]
|
||||||
|
});
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import { createRawSnippet } from 'svelte';
|
||||||
|
|
||||||
|
const snippet = createRawSnippet(() => ({
|
||||||
|
render: () => `
|
||||||
|
<!-- --><div>123</div>
|
||||||
|
`
|
||||||
|
}));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{@render snippet()}
|
Loading…
Reference in new issue