Skip to content

Commit

Permalink
Apply suggestions to build/index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 27, 2020
1 parent 1d8752b commit 27bbb2b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/next/build/index.ts
Expand Up @@ -63,6 +63,7 @@ import {
} from './utils'
import getBaseWebpackConfig from './webpack-config'
import { writeBuildId } from './write-build-id'
import escapeStringRegexp from 'escape-string-regexp'

const fsAccess = promisify(fs.access)
const fsUnlink = promisify(fs.unlink)
Expand Down Expand Up @@ -535,11 +536,6 @@ export default async function build(dir: string, conf = null): Promise<void> {
routesManifest.serverPropsRoutes = {}

for (const page of serverPropsPages) {
const cleanDataRoute = path.posix.join(
'/_next/data',
buildId.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&'),
`${page === '/' ? '/index' : page}.json`
)
const dataRoute = path.posix.join(
'/_next/data',
buildId,
Expand All @@ -553,7 +549,13 @@ export default async function build(dir: string, conf = null): Promise<void> {
/\(\?:\\\/\)\?\$$/,
'\\.json$'
)
: new RegExp(`^${cleanDataRoute}$`).source,
: new RegExp(
`^${path.posix.join(
'/_next/data',
escapeStringRegexp(buildId),
`${page === '/' ? '/index' : page}.json`
)}$`
).source,
}
}

Expand Down

0 comments on commit 27bbb2b

Please sign in to comment.