ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.55k stars 106 forks source link

Identifier 'location' has already been declared #257

Closed xland closed 2 years ago

xland commented 2 years ago

svelte:3.46.4 svelte-spa-router:3.2.0 error info:

Uncaught SyntaxError: Identifier 'location' has already been declared

App.svelte

<script>
  import Router from "svelte-spa-router";
  import { routes } from "./routes";
</script>

<Router {routes} />

<style lang="scss">
</style>

routes.ts

import Login from "./Login.svelte";

export let routes = {
  "/login": Login,
};

When I comment out this sentence,The error is gone. node_modules\svelte-spa-router\Router.svelte

export const location = derived(loc, ($loc) => $loc.location);
xland commented 2 years ago

rollup config outputOption format: "cjs",

ItalyPaleAle commented 2 years ago

Hi @xland the code is working fine for me and the issue may be somewhere else in your codebase. I will need more information to be able to replicate this error.

ItalyPaleAle commented 2 years ago

Closing for now. Please feel free to re-open if you still experience this issue.

xland commented 2 years ago

Sorry for late reply. Close it is ok. I can not supply more info to replicate this error.(My code is complicated and is based on Electron)