Fix basePath?
This commit is contained in:
parent
9a0b83c992
commit
a57654f05a
2 changed files with 4 additions and 2 deletions
|
@ -3,8 +3,9 @@ import { useRouter } from "next/router";
|
||||||
|
|
||||||
const Link = (props: LinkProps) => {
|
const Link = (props: LinkProps) => {
|
||||||
const { basePath } = useRouter();
|
const { basePath } = useRouter();
|
||||||
const propHrefWithoutLeadingSlash = props.href ? props.href.replace(/^\//, "") : props.href;
|
const propHrefWithoutLeadingSlash = props.href && props.href.startsWith("/") ? props.href.substr(1) : props.href;
|
||||||
const href = basePath ? `/${basePath}/${propHrefWithoutLeadingSlash}` : props.href;
|
const href = basePath ? `${basePath}/${propHrefWithoutLeadingSlash}` : props.href;
|
||||||
|
console.log(href)
|
||||||
return <GeistLink {...props} href={href} />
|
return <GeistLink {...props} href={href} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
basePath: "/drift",
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue