I have written and published a svelte library that makes the form validation library vest easy to use with svelte. I have thoroughly tested it, and it works great, also with a local path dependency. But as soon as I import the library from npm I get this error:
Function called outside component initialization
I'm pretty sure the function in question is setContext(). The thing is... I'm sure it's not called outside component initialization, and if I just copy the source of the .ts file into my project it works again.
I assume that somehow they have access to different svelte versions, and that's what's causing the mixup. But I don't see how it's possible, because I don't have svelte as a dependency, only as a peer dependency (I also tried removing it from peerDependencies but that didn't change anything).
Here is the repo: https://github.com/enyo/use-vest
Here is repo that can replicate the issue: https://github.com/enyo/use-vest-repro