Skip to content

Commit

Permalink
this should be equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Jul 31, 2020
1 parent e47ce6f commit acaedb3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions packages/next/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RouterContext } from '../next-server/lib/router-context'
import { isDynamicRoute } from '../next-server/lib/router/utils/is-dynamic'
import * as envConfig from '../next-server/lib/runtime-config'
import { getURL, loadGetInitialProps, ST } from '../next-server/lib/utils'
import { delBasePath } from '../next-server/lib/router/router'
import { delBasePath, basePath } from '../next-server/lib/router/router'
import initHeadManager from './head-manager'
import PageLoader from './page-loader'
import measureWebVitals from './performance-relayer'
Expand Down Expand Up @@ -52,15 +52,7 @@ envConfig.setConfig({
let asPath = getURL()

// make sure not to attempt stripping basePath for 404s
if (
page !== '/404' &&
!(
page === '/_error' &&
hydrateProps &&
hydrateProps.pageProps &&
hydrateProps.pageProps.statusCode === 404
)
) {
if (asPath.startsWith(basePath)) {
asPath = delBasePath(asPath)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/next/next-server/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
normalizePathTrailingSlash,
} from '../../../client/normalize-trailing-slash'

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

function buildCancellationError() {
return Object.assign(new Error('Route Cancelled'), {
Expand Down

0 comments on commit acaedb3

Please sign in to comment.