500 - Function called outside component initialization
See original GitHub issueI am trying to use this library in sveltekit with vitejs. Everthing works fine, but when i restart the dev server, i get this error:
500
Function called outside component initialization
Error: Function called outside component initialization
at get_current_component (/path/to/project/node_modules/.pnpm/svelte-use-form@2.0.1/node_modules/svelte-use-form/dist/index.umd.js:118:19)
What could be the reason that I get this error? Can this be solved? I have seen that this error has also already occurred in Sapper. Maybe i should use svelte for my frontend after all 😄
I use the library in my component like this:
<script>
import { useForm } from 'svelte-use-form'
const form = useForm()
</script>
or do i need to wrapp it in a onMount
function?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Function called outside component initialization - Stack Overflow
i wanna to recall the onMount in my Svelte app by clicking some button, but i got this error. Any idea would be...
Read more >Function called outside component initialization #592 - GitHub
I'm getting a Function called outside component initialization error from a sapper v0.26.0-alpha.10 project. A component is being loaded ...
Read more >How to fix "Function called outside component initialization ...
Recently, a sapper-based project went over the limit for the size of the built image sent to the cloud platform we were using....
Read more >Svelte - Function called outside component initialization from ...
Svelte - Function called outside component initialization from brand new SvelteKit installation. Hi there,. I have got a very weird behaviour ...
Read more >8 Lifecycle functions - Svelte and Sapper in Action
Call these functions, passing them a function to be called when the event occurs. They must be called during component initialization.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i created a small repo: https://github.com/niklasgrewe/svelte-use-form-500-error i tested the library
svelte-hero-icons
and i don’t get any errors on itIm still looking for a solution but for now adding
to your vite.config.js fixes it.