question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.

See original GitHub issue

Hi I try to deploy my app to production using sirve public --host 0.0.0.0

but I get Caught exception while replacing the current page. If you’re running this in the Svelte REPL, please note that the replace method might not work in this environment.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ItalyPaleAlecommented, Apr 17, 2020

I figured the issue. It’s not the server.

In your App.svelte:

function conditionsFailed(event) {
    if(event.detail.name === 'Principal')
      replace('/login');
    else replace('/');

  }

This is causing a redirection loop when the app is compiled for production. The reason is that when the code is minified, the class name changes and it’s not Principal anymore. This doesn’t happen in development because the code isn’t minified.

How you can fix it: rather than relying on event.detail.name, pass custom user data (see: https://github.com/ItalyPaleAle/svelte-spa-router/blob/master/Advanced Usage.md#route-pre-conditions )

What I need to do: document that the name of the component might be different when minification runs, so users shouldn’t rely on that

0reactions
xellDartcommented, Apr 10, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the Svelte REPL • REPL • Svelte
You can edit this. Select the 'How to use the Svelte REPL' text and try renaming it to 'My first REPL app'. Over...
Read more >
TypeScript support in Svelte - Learn web development
You'll need a terminal with node and npm installed to compile and build your app. Objective: Learn how to configure and use TypeScript...
Read more >
Command Line | Meteor API Docs
Run a meteor development server in the current project. Searches upward from the current directory for the root directory of a Meteor project....
Read more >
ReferenceError: fetch is not defined - javascript - Stack Overflow
If you're using a version of Node prior to 18, the fetch API is not implemented out-of-the-box and you'll need to use an...
Read more >
Typeerror is not a function typescript - Seba Online
This error happens when JavaScript can't find the setState() function from ... a button or another component to change the state of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found