Files
Niklas MischkulnigandGitHub bb1a57288f Turbopack: inner graph tree shaking (#85973)
Alias "unused import removal"

Closes PACK-5782

Performance:

```
* 58fe2e2e377d877f51f91f50770310d2bbf20987 - WIP: enable by default

pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  380.01s user 53.74s system 691% cpu 1:02.76 total
pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  384.99s user 51.00s system 708% cpu 1:01.57 total
pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  381.52s user 46.86s system 711% cpu 1:00.21 total

vs canary:
* f6c2d49132 - Turbopack: add task_id_details feature (#84970)

pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  374.87s user 48.47s system 760% cpu 55.662 total
pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  379.18s user 50.27s system 700% cpu 1:01.28 total
pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  370.39s user 45.93s system 726% cpu 57.305 total
pnpm next build --experimental-build-mode=compile > ~/Downloads/log.txt 2>&1  372.70s user 46.24s system 717% cpu 58.364 total
```
2025-11-26 10:49:07 +01:00

26 lines
828 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('reference-tree-shaking', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('Should apply removeUnusedImports tree shaking to client and server references', async () => {
const res = await next.fetch('/')
expect(await res.text()).toContain('This is Server')
// Only Turbopack applies inner graph tree shaking here
if (process.env.IS_TURBOPACK_TEST) {
const serverReferences = await next.readFile(
'.next/server/server-reference-manifest.json'
)
expect(serverReferences).not.toContain('library/action.js')
const clientReferences = await next.readFile(
'.next/server/app/page_client-reference-manifest.js'
)
expect(clientReferences).not.toContain('library/client.js')
}
})
})