File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { defaultOverrides } from '../server/require-hook'
24
24
import { nodeFileTrace } from 'next/dist/compiled/@vercel/nft'
25
25
import { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'
26
26
import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
27
+ import isError from '../lib/is-error'
27
28
28
29
const debug = debugOriginal ( 'next:build:build-traces' )
29
30
@@ -339,6 +340,45 @@ export async function collectBuildTraces({
339
340
base : outputFileTracingRoot ,
340
341
processCwd : dir ,
341
342
mixedModules : true ,
343
+ async readFile ( p ) {
344
+ try {
345
+ return await fs . readFile ( p , 'utf8' )
346
+ } catch ( e ) {
347
+ if ( isError ( e ) && ( e . code === 'ENOENT' || e . code === 'EISDIR' ) ) {
348
+ // handle temporary internal webpack files
349
+ if ( p . match ( / s t a t i c [ / \\ ] m e d i a / ) ) {
350
+ return ''
351
+ }
352
+ return null
353
+ }
354
+ throw e
355
+ }
356
+ } ,
357
+ async readlink ( p ) {
358
+ try {
359
+ return await fs . readlink ( p )
360
+ } catch ( e ) {
361
+ if (
362
+ isError ( e ) &&
363
+ ( e . code === 'EINVAL' ||
364
+ e . code === 'ENOENT' ||
365
+ e . code === 'UNKNOWN' )
366
+ ) {
367
+ return null
368
+ }
369
+ throw e
370
+ }
371
+ } ,
372
+ async stat ( p ) {
373
+ try {
374
+ return await fs . stat ( p )
375
+ } catch ( e ) {
376
+ if ( isError ( e ) && ( e . code === 'ENOENT' || e . code === 'ENOTDIR' ) ) {
377
+ return null
378
+ }
379
+ throw e
380
+ }
381
+ } ,
342
382
} )
343
383
const reasons = result . reasons
344
384
const fileList = result . fileList
You can’t perform that action at this time.
0 commit comments