File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 11import { Controller } from '@hotwired/stimulus' ;
2- import { VERSION } from 'svelte/compiler' ;
32
43class default_1 extends Controller {
54 async connect ( ) {
@@ -39,8 +38,8 @@ class default_1 extends Controller {
3938 this . dispatch ( name , { detail, prefix : 'svelte' } ) ;
4039 }
4140 async mountSvelteComponent ( Component , options ) {
42- if ( VERSION ?. startsWith ( '5' ) ) {
43- const { mount } = await import ( 'svelte' ) ;
41+ const { mount } = await import ( 'svelte' ) ;
42+ if ( mount ) {
4443 return mount ( Component , options ) ;
4544 }
4645 return new Component ( options ) ;
Original file line number Diff line number Diff line change 11import { Controller } from '@hotwired/stimulus' ;
22import type { SvelteComponent , ComponentConstructorOptions , ComponentType } from 'svelte' ;
3- import { VERSION as SVELTE_VERSION } from 'svelte/compiler' ;
43
54export default class extends Controller < Element & { root ?: SvelteComponent } > {
65 private app : SvelteComponent ;
@@ -70,9 +69,10 @@ export default class extends Controller<Element & { root?: SvelteComponent }> {
7069 Component : ComponentType ,
7170 options : ComponentConstructorOptions
7271 ) : Promise < SvelteComponent > {
73- if ( SVELTE_VERSION ?. startsWith ( '5' ) ) {
74- // @ts -ignore
75- const { mount } = await import ( 'svelte' ) ;
72+ // @ts -ignore
73+ const { mount } = await import ( 'svelte' ) ;
74+ if ( mount ) {
75+ // `mount` is only available in Svelte >= 5
7676 return mount ( Component , options ) ;
7777 }
7878
You can’t perform that action at this time.
0 commit comments