What to use now that base
from "$app/paths"
is being deprecated?
#14179
-
I've got a SvelteKit website that has it's <script>
import { page } from "$app/state";
import { base, resolve } from "$app/paths";
// Converts "/foo/bar/*" to "/*"
const relPath = $derived(page.url.pathname.slice(base.length));
</script>
<a href={resolve("/")} class:active={relPath === "/"}>Home</p>
<a href={resolve("/my-page")} class:active={relPath === "/my-page"}>My Page</a>
<style>
a.active {
color: red;
}
</style> However, I'm getting a warning that |
Beta Was this translation helpful? Give feedback.
Answered by
peterreeves
Aug 12, 2025
Replies: 1 comment
-
Just discovered |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
peterreeves
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just discovered
page.route.id
, which seems to do what I need.