mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
eb14325ed4
Closes PACK-6539 When `experimental.runtimeServerDeploymentId` is enabled, read the `process.env.NEXT_DEPLOYMENT_ID` and append to the chunks when evaluating the `client-reference-manifest.js` Originally, I tried to do it after the manifest is loaded (in `loadComponents` or in the `RouteModule.prepare`) to "hydrate" the manifest, but that is too late because the manifest needs to be initialized immediately to make module-evaluation-time server actions work (which need the manifest immediately)
26 lines
898 B
TypeScript
26 lines
898 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { getClientReferenceManifest } from 'next-test-utils'
|
|
|
|
describe('client-reference-chunking', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
})
|
|
|
|
it('should use the same chunks for client references across routes', async () => {
|
|
const browser = await next.browser('/')
|
|
await browser.elementByCss('a[href="/issue"]').click()
|
|
|
|
expect(await browser.elementByCss('body').text()).toContain(
|
|
'Welcome to the Issue Page'
|
|
)
|
|
|
|
let rootManifest = getClientReferenceManifest(next, '/page')
|
|
let issueManifest = getClientReferenceManifest(next, '/issue/page')
|
|
|
|
// These two routes have the same client component references, so these should be exactly the
|
|
// same (especially the `chunks` field)
|
|
expect(rootManifest.clientModules).toEqual(issueManifest.clientModules)
|
|
})
|
|
})
|