[next] Ensure manifests are specific to the included pages (#8172)

### Related Issues

This updates to filter the `routes-manifest` and `pages-manifest` to only include entries for the pages that are being included in the specific serverless function. This fixes the case where multiple dynamic routes could match a path but one is configured with `fallback: false` so shouldn't match when executing for a different dynamic route. 

A regression test for this specific scenario has been added in the `00-mixed-dynamic-routes` fixture. 

### 📋 Checklist

<!--
  Please keep your PR as a Draft until the checklist is complete
-->

#### Tests

- [ ] The code changed/added as part of this PR has been covered with tests
- [ ] All tests pass locally with `yarn test-unit`

#### Code Review

- [ ] This PR has a concise title and thorough description useful to a reviewer
- [ ] Issue from task tracker has a link to this PR
This commit is contained in:
JJ Kasper
2022-07-20 18:06:44 -05:00
committed by GitHub
parent 5dc6f48e44
commit 8cf67b549b
8 changed files with 209 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
const os = require('os');
const path = require('path');
const fs = require('fs-extra');
const { glob, getWriteableDirectory } = require('@vercel/build-utils');
const { glob } = require('@vercel/build-utils');
function runAnalyze(wrapper, context) {
if (wrapper.analyze) {
@@ -37,7 +39,13 @@ async function runBuildLambda(inputPath) {
config: build.config,
});
const workPath = await fs.realpath(await getWriteableDirectory());
const workPath = path.join(
os.tmpdir(),
`vercel-${Date.now()}-${Math.floor(Math.random() * 100)}`
);
await fs.ensureDir(workPath);
console.log('building in', workPath);
const buildResult = await wrapper.build({
files: inputFiles,
entrypoint,