File size: 445 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import { addPathPrefix } from '../shared/lib/router/utils/add-path-prefix'
import { normalizePathTrailingSlash } from './normalize-trailing-slash'

const basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''

export function addBasePath(path: string, required?: boolean): string {
  return normalizePathTrailingSlash(
    process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required
      ? path
      : addPathPrefix(path, basePath)
  )
}