Commit cc6fe5fd authored by Lukáš Huvar's avatar Lukáš Huvar Committed by Tim Neutkens

Fixes problem with API and wrong regex (#8126)

* Fixes regex for client bundel. Fixes #8115

* Add test

* Update test/integration/api-support/test/index.test.js
Co-Authored-By: 's avatarTim Neutkens <tim@timneutkens.nl>

* Update test/integration/api-support/test/index.test.js
Co-Authored-By: 's avatarTim Neutkens <tim@timneutkens.nl>
parent a2b2a2a3
...@@ -9,6 +9,7 @@ import { stringify } from 'querystring' ...@@ -9,6 +9,7 @@ import { stringify } from 'querystring'
import { findPageFile } from './lib/find-page-file' import { findPageFile } from './lib/find-page-file'
import { isWriteable } from '../build/is-writeable' import { isWriteable } from '../build/is-writeable'
import * as Log from '../build/output/log' import * as Log from '../build/output/log'
import { API_ROUTE } from '../lib/constants'
const ADDED = Symbol('added') const ADDED = Symbol('added')
const BUILDING = Symbol('building') const BUILDING = Symbol('building')
...@@ -56,7 +57,7 @@ export default function onDemandEntryHandler ( ...@@ -56,7 +57,7 @@ export default function onDemandEntryHandler (
invalidator.startBuilding() invalidator.startBuilding()
const allEntries = Object.keys(entries).map(async page => { const allEntries = Object.keys(entries).map(async page => {
if (compiler.name === 'client' && page.startsWith('/api')) { if (compiler.name === 'client' && page.match(API_ROUTE)) {
return return
} }
const { name, absolutePagePath } = entries[page] const { name, absolutePagePath } = entries[page]
......
...@@ -275,6 +275,13 @@ function runTests (serverless = false) { ...@@ -275,6 +275,13 @@ function runTests (serverless = false) {
expect( expect(
existsSync(join(appDir, '.next/server/pages-manifest.json'), 'utf8') existsSync(join(appDir, '.next/server/pages-manifest.json'), 'utf8')
).toBeTruthy() ).toBeTruthy()
const buildManifest = JSON.parse(
readFileSync(join(appDir, '.next/build-manifest.json'), 'utf8')
)
expect(
Object.keys(buildManifest.pages).includes('/api-conflict')
).toBeTruthy()
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment