title: page.js with svelte `The requested URL was not found` when entering URL manually or refreshing despite passing --single flag in package.json
body: <p>I'm new to the whole Javascript &amp; svelte ecosystem and am trying to build an app with svelte.js and using flask to serve it. The issue is I get <code>The requested URL was not found</code> when i enter the path manually or refresh the page. This happens despite passing the --single flag in package.json. The strange thing is, I face the issue only when the route has associated params eg. <code>/article/:id</code> . However if I enter the path <code>/article</code> manually or refresh it, there is no issue.</p>
  <p>Here's a snippet of package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;svelte-app&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;scripts&quot;: {
      &quot;build&quot;: &quot;rollup -c&quot;,
      &quot;dev&quot;: &quot;rollup -c -w&quot;,
      &quot;start&quot;: &quot;sirv public --single&quot;,
      &quot;start:dev&quot;: &quot;sirv public --dev --single&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;rollup&quot;: &quot;^2.3.4&quot;,
      &quot;rollup-plugin-livereload&quot;: &quot;^2.0.0&quot;,
    },
    &quot;dependencies&quot;: {
      &quot;gridjs&quot;: &quot;^5.0.2&quot;,
    }
  }
  </code></pre>
  <p>Here's a snippet of my App.svelte file</p>
  <pre><code>&lt;script&gt;
    import {onMount} from 'svelte';
    import page from 'page';
    import Home from './pages/Home.svelte';
    import ArticleOverview from './pages/ArticleOverview.svelte';
    import SingleArticle from './pages/SingleArticle.svelte';
  
    let current;
    let params;
  
    onMount(async () =&gt; {
          const res = await fetch(`/some_api`);
          const outcome = await res.json().then((outputDetails) =&gt; {
          console.log(outputDetails);
        });
      });
  
    page('/', () =&gt; (current = Home));
    page('/article', () =&gt; (current = ArticleOverview));
    page('/article/:id', 
      (ctx, next) =&gt; {
        params = ctx.params
        next()
      },
      () =&gt; (current = SingleArticle));
      page('/*', () =&gt; (current = NotFound));
  
      page.start();
  &lt;/script&gt;
  
  &lt;svelte:component this=&quot;{current}&quot; params=&quot;{params}&quot;/&gt;
  </code></pre>