Skip to content

Do not include the basePath while using Link #63674

Discussion options

You must be logged in to vote
const nextConfig = {
    experimental: {
        manualClientBasePath: true
    }
}

This is experimental feature so it is showing strange behaviour and I think it is not suitable for production so have done this work around by appeding the domain to the url path . it prevents nextjs to append the basePath and it does not break the single page behaviour.

Link.tsx

import type { UrlObject } from "url";
import NextLink from "next/link";
import { ComponentProps, FC } from "react";

export interface ILinkProps extends ComponentProps<typeof NextLink> {}

const DOMAIN = process.env.NEXT_PUBLIC_HOST || "";

type Url = string | UrlObject;

export const getURL = (url: Url) => {
  const pathname = t…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by webtonative-himanshu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants