svelma
svelma copied to clipboard
Referencing current_component from svelte/internal has broken the Input component when used with Nollup
This change was introduced in a recent commit. See: https://github.com/c0bra/svelma/commit/206322dee640b3a2e798ccafe982fbce0f8c03ba As a result, the current_component import has a value of undefined when passed into the getEventsAction function.
To reproduce, use the Nollup template and add an Input tag to the App. The below stack trace occurs.
TypeError: Cannot read property '$$' of undefined
at eval (node_modules/svelma/src/utils/index.js:44:42)
at Object.mount [as m] (eval at <anonymous> (https://localhost/build/bundle.js:40958:17), <anonymous>:161:58)
at mount (eval at <anonymous> (https://localhost/build/bundle.js:40958:17), <anonymous>:410:14)
at Object.targetCmp.$$.fragment.m (node_modules/svelte-hmr/runtime/svelte-hooks.js:189:24)
at mount_component (node_modules/svelte/internal/index.mjs:1376:26)
at Object.mount [as m] (eval at <anonymous> (https://localhost/build/bundle.js:460:17), <anonymous>:64:4)
at mount_component (node_modules/svelte/internal/index.mjs:1376:26)
at init (node_modules/svelte/internal/index.mjs:1465:9)
at new App (eval at <anonymous> (https://localhost/build/bundle.js:460:17), <anonymous>:114:3)
at createProxiedComponent (node_modules/svelte-hmr/runtime/svelte-hooks.js:237:9)
Swapping the import from: import { current_component } from 'svelte/internal'
to: import { get_current_component } from 'svelte/internal'
And the reference on line 131 becomes: const events = getEventsAction(get_current_component());
This has fixed it for my scenario.
Svelma: 0.4.0 Svelte: 3.24.1 Nollup: 0.13.2 Rollup: 2.23.1