Skip to content

Commit

Permalink
Use addDependency to track metadata route file changes (#66714)
Browse files Browse the repository at this point in the history
Use `addDependency` to track the file path passed to
`next-metadata-route-loader`

NOTE: We cannot apply the `next-metadata-route-loader` directly to the
metatda convention source files, since the json file could be processed
by json loader (Related previous fix #62615)

Previously when we passed down the file path as argument to the loader,
which sort of breaking the caching of webpack as the actual resource
path is string, it's not tracked as a dependency. This change fixed the
bad caching issue of static metadata routes. Based on the above reason
we use `addDependency` here to track the dependency change

Closes NEXT-3521
Closes #65755
  • Loading branch information
huozhi committed Jul 9, 2024
1 parent f0008d8 commit 6c661d2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/next/src/build/webpack/loaders/next-app-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ async function createAppRouteCode({
const isDynamic = pageExtensions.includes(ext)

resolvedPagePath = `next-metadata-route-loader?${stringify({
page,
filePath: resolvedPagePath,
isDynamic: isDynamic ? '1' : '0',
})}!?${WEBPACK_RESOURCE_QUERIES.metadataRoute}`
Expand Down

0 comments on commit 6c661d2

Please sign in to comment.