Unverified Commit a61b9703 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: include fewer traced files for standalone (#88322)

This removes quite a lot of files.

But some of them are simply needed because we load `build/swc/index.js`, e.g. the two following examples. Removing them would require some more refactoring.

<img width="1274" height="680" alt="Bildschirmfoto 2026-01-09 um 14 22 07" src="https://github.com/user-attachments/assets/2354b9f2-1bfd-438d-af54-e69e8934cbc4" />
<img width="1346" height="474" alt="Bildschirmfoto 2026-01-09 um 14 23 15" src="https://github.com/user-attachments/assets/8f516cd6-321e-4f9c-bade-19eed7093c88" />
parent b09df006
...@@ -1263,7 +1263,10 @@ export async function copyTracedFiles( ...@@ -1263,7 +1263,10 @@ export async function copyTracedFiles(
} }
try { try {
const packageJsonPath = path.join(distDir, '../package.json') const packageJsonPath = path.join(distDir, '../package.json')
const packageJsonContent = await fs.readFile(packageJsonPath, 'utf8') const packageJsonContent = await fs.readFile(
/* turbopackIgnore: true */ packageJsonPath,
'utf8'
)
const packageJson = JSON.parse(packageJsonContent) const packageJson = JSON.parse(packageJsonContent)
moduleType = packageJson.type === 'module' moduleType = packageJson.type === 'module'
...@@ -1280,7 +1283,9 @@ export async function copyTracedFiles( ...@@ -1280,7 +1283,9 @@ export async function copyTracedFiles(
const copiedFiles = new Set() const copiedFiles = new Set()
async function handleTraceFiles(traceFilePath: string) { async function handleTraceFiles(traceFilePath: string) {
const traceData = JSON.parse(await fs.readFile(traceFilePath, 'utf8')) as { const traceData = JSON.parse(
await fs.readFile(/* turbopackIgnore: true */ traceFilePath, 'utf8')
) as {
files: string[] files: string[]
} }
const copySema = new Sema(10, { capacity: traceData.files.length }) const copySema = new Sema(10, { capacity: traceData.files.length })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment