Commit 6c661d2c authored by Jiachi Liu's avatar Jiachi Liu

Use addDependency to track metadata route file changes (#66714)

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
parent f0008d86
...@@ -127,7 +127,6 @@ async function createAppRouteCode({ ...@@ -127,7 +127,6 @@ async function createAppRouteCode({
const isDynamic = pageExtensions.includes(ext) const isDynamic = pageExtensions.includes(ext)
resolvedPagePath = `next-metadata-route-loader?${stringify({ resolvedPagePath = `next-metadata-route-loader?${stringify({
page,
filePath: resolvedPagePath, filePath: resolvedPagePath,
isDynamic: isDynamic ? '1' : '0', isDynamic: isDynamic ? '1' : '0',
})}!?${WEBPACK_RESOURCE_QUERIES.metadataRoute}` })}!?${WEBPACK_RESOURCE_QUERIES.metadataRoute}`
......
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