-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Function called outside component initialization #61
Comments
you need to add |
Whoops, totally correct. Thanks! |
well, it's not exactly intuitive - I made the same mistake :) |
@patrickleet why would you add it as a dev dependency? it's part of the build right? |
A bundle is created so technically most of the deps can just exist for the build step. I saw more discussion somewhere about what should and shouldn't be a devDep with that in mind but can't find where that was. |
I have the same problem and moving
One special aspect of my setup is that I have a Yarn workspace and my Svelte app (built with Svelte-Kit) sits inside one of its packages. So the |
If svelte is built by vite, you have to add |
The error "Function called outside component initialization" is encountered by many, and its cause always is obscure to the developer. This issue is commonly raised on Stackoverflow, Github, and other platforms, with no success at receiving a concrete solution. This was also recently mentioned in issue timhall#61, but no initiative was taken.
Unfortunately, this doesn't solve the issue at hand. |
While setting up
svelte-apollo
with Sapper (#9), as there is no mainApp.svelte
component, I tried to set the client in the_layout.svelte
file.However, I get the following error:
Where should I set the client instead?
Edit
In previous versions of
v0.3.0
, the solution that #9 (comment) comments would work fine, but inv0.4.0
we must set the client with the proper method.The text was updated successfully, but these errors were encountered: