-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include proper instrumentation entry in required files manifest (#68983)
### What When the `edge-instrumentation.js` is not built, we do not include it into the serve required manifest. We moved the write of required server files manifest to a late phase, where we used the edge routes counter to determine if we need to write the edge entry file of instrumentation into manifest x-ref: https://github.com/vercel/next.js/actions/runs/10416595866/job/28850695138
- Loading branch information
Showing
5 changed files
with
131 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/production/instrumentation/required-files-instrumentation-entry/app/node/route.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function GET() { | ||
return new Response('node') | ||
} |
1 change: 1 addition & 0 deletions
1
test/production/instrumentation/required-files-instrumentation-entry/instrumentation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function register() {} |
6 changes: 6 additions & 0 deletions
6
test/production/instrumentation/required-files-instrumentation-entry/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
experimental: { | ||
instrumentationHook: true, | ||
}, | ||
} |
19 changes: 19 additions & 0 deletions
19
...ntation/required-files-instrumentation-entry/required-files-instrumentation-entry.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
async function readRequiredFilesManifest(next: any) { | ||
const manifest = JSON.parse( | ||
await next.readFile('.next/required-server-files.json') | ||
) | ||
return manifest.files | ||
} | ||
|
||
describe('instrumentation - required-files-instrumentation-entry', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should not contain edge entry in required files manifest', async () => { | ||
const requiredFiles = await readRequiredFilesManifest(next) | ||
expect(requiredFiles).not.toContain('.next/server/edge-instrumentation.js') | ||
}) | ||
}) |