I initially posted this issue here because I believed it was a bug, but I'm getting no responses.
Basically, onMount
is not being called in my sapper routes. Maybe sapper is not hydrating my component after the server initially renders it...
src/routes/test.svelte
<script>
import { onMount } from 'svelte';
onMount(() => {
console.log("FOO")
});
</script>
I am not seeing FOO
in the console... any idea what the problem is?
Note that this code is working fine on this svelte repl (without sapper).
Problem solved thanks to @artur-sim:
Check client.js file there is a target object pointing to #sapper div, in template html, may be you some how accidentally modified something there
in your client js shoud be like this
import * as sapper from '@sapper/app'; sapper.start({ target: document.querySelector('#sapper') });