title: I get "Function called outside component initialization" when using an npm library
body: <p>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:</p>
  <blockquote>
  <p><strong>Function called outside component initialization</strong></p>
  </blockquote>
  <p>I'm pretty sure the function in question is <code>setContext()</code>. 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.</p>
  <p>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 <code>peerDependencies</code> but that didn't change anything).</p>
  <p>Here is the repo: <a href="https://github.com/enyo/use-vest/tree/f5c85db3583b51b5b2bd0608ca5cfe3b1f285591" rel="nofollow noreferrer">https://github.com/enyo/use-vest</a></p>
  <p>Here is repo that can replicate the issue: <a href="https://github.com/enyo/use-vest-repro" rel="nofollow noreferrer">https://github.com/enyo/use-vest-repro</a></p>