silverwolf-x/project / packages /next /src /client /remove-base-path.ts
silverwolf-x's picture
download
raw
478 Bytes
import { hasBasePath } from './has-base-path'
const basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''
export function removeBasePath(path: string): string {
if (process.env.__NEXT_MANUAL_CLIENT_BASE_PATH) {
if (!hasBasePath(path)) {
return path
}
}
// Can't trim the basePath if it has zero length!
if (basePath.length === 0) return path
path = path.slice(basePath.length)
if (!path.startsWith('/')) path = `/${path}`
return path
}

Xet Storage Details

Size:
478 Bytes
·
Xet hash:
6dc08fa7969b6704a24023a14bcbc445bf58916edbcbc332cfd78917897d0d07

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.