Repository navigation
[core] yarn build omits packages from metadata.json in Next.js Pages Router - #646
Conversation
🦋 Changeset detectedLatest commit: c27e94c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Package Size and Test Coverage Report
|
illiakovalenko
left a comment
There was a problem hiding this comment.
I think this treats the symptom rather than the cause.
metadata.json is missing @sitecore-content-sdk/personalize on a Yarn Pages Router app because the package is not installed: nextjs imports it in for exmaple proxy/personalize-proxy.js but only declares it as a peer, the Pages Router template does not list it, and Yarn does not install missing peers. With this PR, yarn build still fails:
Module not found: Can't resolve '@sitecore-content-sdk/personalize'
and metadata.json would list a package that is not in node_modules or the lockfile.
Add @sitecore-content-sdk/personalize to the Pages Router template's dependencies, as the App Router template already does. I tried it on a scaffolded app with Yarn 1.22.22 yarn build passes and metadata.json contains personalize at 2.1.0, so the metadata.ts changes can be dropped.
If the peer lookup stays, it has a few problems: the version comes from the registry rather than the install, every build makes blocking network calls (20s timeout per missing peer), registry auth and proxy config are ignored, and only process.cwd()/node_modules is checked, which misses hoisted and pnpm installs.
Description / Motivation
@sitecore-content-sdk/personalizeto the Next.js Pages Router template dependencies, matching the App Router templates.yarn buildcould not resolve it and.sitecore/metadata.jsonomitted it.Testing Details
Types of changes