-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Uncaught TypeError: y.fragment.l is not a function #2901
Comments
Please give a small component that reproduces this. |
The |
Please reopen if you have a repro and the issue isn't that you are hydrating without compiling with it enabled. |
First of all, thanks. I forgot to turn it on when compiling |
This took me awhile to figure this out. To perhaps save other folks some time, for SSR there are 3 considerations: 1. Rendering HTML svelte.compile(code, {
filename: "...",
generate: 'ssr'
}) You do not need 2. Compile the client svelte.compile(code, {
filename: "...",
generate: 'dom',
hydratable: true
}) You do need 3. Render the client App.render({
target: document.body,
hydrate: true
}) You do need It makes perfect sense now, but the error is a bit terse and it seemed like a Svelte bug. |
@Conduitry Maybe the detailed tutorial of ssr with Svelte should be an independent chapter on the official document? |
Anyway thanks for the tip @matthewmueller ! |
To add onto what matthewmueller said, hydratable is something you need to add to your webpack config, so Svelte compiles something that can be consumed SSR. I think this is an area where some better error messages might help. |
@vish01 are you using This option is only for compiling the client-side component that will hydrate the server-rendered HTML. If you're hydrating, you also need to set |
@PierBover I'm using
Let me know if I'm doing something wrong. I'm not an expert at this haha. |
@vish01 like I said, the See this comment just above: #2901 (comment) |
@PierBover Sorry I forgot to mention that I'm importing the component on the client side in a different way. I'm fetching a svelte component from another server like this:
Isn't this considered as client side hydrating? Since I'm importing a svelte component at the client side. |
No description provided.
The text was updated successfully, but these errors were encountered: