Skip to content

Commit 1812b99

Browse files
committedNov 28, 2023
Issue #25: Move to mount() instead of new to instantiate components.
1 parent f3e884b commit 1812b99

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed
 

‎demo/vercel/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"devDependencies": {
13-
"@sveltejs/vite-plugin-svelte": "^2.4.6",
14-
"svelte": "^4.0.5",
15-
"vite": "^4.3.0"
13+
"@sveltejs/vite-plugin-svelte": "^3.0.0-next.3",
14+
"svelte": "^5.0.0-next.14"
1615
}
1716
}

‎index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createSvelteSlots, findSlotParent, unwrap } from './utils.js';
2-
2+
import { mount } from 'svelte';
33

44
// Tracks the mapping of case-insensitive attributes to case-sensitive component props on a per-tag basis. Setup as a
55
// global cache so we can avoid setting up a Proxy on every single component render but also to assist in mapping during
@@ -471,7 +471,7 @@ export default function(opts) {
471471

472472
// Instantiate component into our root now, which is either the "light DOM" (i.e. directly under this element) or
473473
// in the shadow DOM.
474-
this.componentInstance = new opts.component({ target: this._root, props: props, context });
474+
this.componentInstance = mount(opts.component, { target: this._root, props: props, context });
475475

476476
this._debug('renderSvelteComponent(): completed');
477477
}

0 commit comments

Comments
 (0)