fix(nextjs): Update glob for cache output (#31177)

This PR refines the Next.js package plugin’s output glob to exclude the
.next/cache directory. Caching that path via AWS S3 leads to checksum
mismatches when restoring from the remote cache, so it’s now omitted.

related: https://github.com/nrwl/nx/issues/30338
This commit is contained in:
Nicholas Cunningham 2025-05-12 14:42:07 -06:00 committed by GitHub
parent 5677831b17
commit f20b2e6a02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ exports[`@nx/next/plugin integrated projects should create nodes 1`] = `
"tty": false, "tty": false,
}, },
"outputs": [ "outputs": [
"{workspaceRoot}/my-app/.next", "{workspaceRoot}/my-app/.next/!(cache)/**/*",
"{workspaceRoot}/my-app/.next/!(cache)", "{workspaceRoot}/my-app/.next/!(cache)",
], ],
}, },
@ -109,7 +109,7 @@ exports[`@nx/next/plugin root projects should create nodes 1`] = `
"tty": false, "tty": false,
}, },
"outputs": [ "outputs": [
"{projectRoot}/.next", "{projectRoot}/.next/!(cache)/**/*",
"{projectRoot}/.next/!(cache)", "{projectRoot}/.next/!(cache)",
], ],
}, },

View File

@ -207,7 +207,7 @@ async function getBuildTargetConfig(
dependsOn: ['^build'], dependsOn: ['^build'],
cache: true, cache: true,
inputs: getInputs(namedInputs), inputs: getInputs(namedInputs),
outputs: [nextOutputPath, `${nextOutputPath}/!(cache)`], outputs: [`${nextOutputPath}/!(cache)/**/*`, `${nextOutputPath}/!(cache)`],
}; };
// TODO(ndcunningham): Update this to be consider different versions of next.js which is running // TODO(ndcunningham): Update this to be consider different versions of next.js which is running