Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/next/src/build/adapter/build-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,14 @@ async function getSharedNodeAssets({
)
currentDependencies.push(modulePath)

if (type === 'pages' && bundler === Bundler.Turbopack) {
currentDependencies.push(
require.resolve(
'next/dist/compiled/next-server/pages-turbo.runtime.prod.js'
)
)
}

const contextDir = path.join(
path.dirname(modulePath),
'vendored',
Expand Down
19 changes: 18 additions & 1 deletion test/production/adapter-config/adapter-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { AdapterOutput, NextAdapter } from 'next'
import { version as nextVersion } from 'next/package.json'

describe('adapter-config', () => {
const { next } = nextTestSetup({
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
})

Expand Down Expand Up @@ -391,6 +391,23 @@ describe('adapter-config', () => {
// pages should have vendored context files traced
expect(pagesVendoredContexts.length).toBeGreaterThan(0)

if (isTurbopack) {
const pagesApiOutput = outputs.pagesApi.find(
(output) =>
output.pathname === '/docs/api/node-pages' &&
output.runtime === 'nodejs'
)

expect(pagesApiOutput).toBeDefined()
expect(
Object.keys(pagesApiOutput!.assets).some((asset) =>
/[\\/]next[\\/]dist[\\/]compiled[\\/]next-server[\\/]pages-turbo\.runtime\.prod\.js$/.test(
asset
)
)
).toBe(true)
}

for (const route of edgeOutputs) {
try {
expect(route.id).toBeString()
Expand Down
Loading