Skip to content

Commit

Permalink
Ensure we copy map file as well for experimental tracing (#68676)
Browse files Browse the repository at this point in the history
These files can be present if server source maps flag is enabled so need
copying as well. Also removes incorrect `_not-found` special case which
will need revisiting and updating define-env check to not apply in dev.

x-ref: [slack
thread](https://vercel.slack.com/archives/C056QDZARTM/p1723119830912809)
  • Loading branch information
ijjk authored Aug 8, 2024
1 parent e8dec1f commit 7c10fcf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,7 @@ export async function detectChangedEntries({
}

for (const entry of appPaths || []) {
let normalizedEntry = getPageFromPath(entry, pageExtensions)

if (normalizedEntry === '/not-found') {
normalizedEntry = '/_not-found'
}
const normalizedEntry = getPageFromPath(entry, pageExtensions)
await detectChange({ entry, normalizedEntry, type: 'app' })
}

Expand Down
11 changes: 11 additions & 0 deletions packages/next/src/build/flying-shuttle/stitch-builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ export async function stitchBuilds(
path.join(shuttleDir, entryFile),
path.join(distDir, entryFile)
)
// copy map file as well if it exists
await fs.promises
.copyFile(
path.join(shuttleDir, `${entryFile}.map`),
path.join(distDir, `${entryFile}.map`)
)
.catch((err) => {
if (err.code !== 'ENOENT') {
throw err
}
})
}
const copySema = new Sema(8)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export function getDefineEnv({
}
const serializedDefineEnv = serializeDefineEnv(defineEnv)

if (Boolean(config.experimental.flyingShuttle)) {
if (!dev && Boolean(config.experimental.flyingShuttle)) {
// we delay inlining these values until after the build
// with flying shuttle enabled so we can update them
// without invalidating entries
Expand Down

0 comments on commit 7c10fcf

Please sign in to comment.