AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Unrecoverable error in component #75

Closed keuller closed 3 years ago

keuller commented 3 years ago

Hey guy! I'm facing a weird error, it is stack trace error from browser console.

[HMR][Svelte] Unrecoverable error in <Dashboard>: next update will trigger a full reload

Uncaught (in promise) Error: Function called outside component initialization

My component's code is very simple like that:

<script lang="ts">
    import { meta } from 'tinro'
    const route = meta()
</script>

<div>
    <p>&nbsp;</p>
    <span>URL: {$route.url}</span>
    <br/>
    <code> {JSON.stringify(route.params)} </code>
</div>

This error only occurs on development mode, also back button does not works. I'm using Vite to generate my bundle and when I generate final bundle all works fine. Anyone has some idea what happen ?

My stack is:

keuller commented 3 years ago

I forgot to add tinro exclusion on Vite's configuration:

  optimizeDeps: {
    exclude: ['tinro']
  }