Skip to content

Commit 54d9fc8

Browse files
authored
fix(examples): guard missing #app mount target in svelte simple example (#10144)
1 parent 75fab82 commit 54d9fc8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

examples/svelte/simple/src/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { mount } from 'svelte'
22
import './app.css'
33
import App from './App.svelte'
44

5-
const app = mount(App, {
6-
target: document.querySelector('#app')!,
7-
})
5+
const target = document.querySelector('#app')
6+
if (!target) throw new Error('Missing #app element')
7+
8+
const app = mount(App, { target })
89

910
export default app

0 commit comments

Comments
 (0)