Sitecore Experience Accelerator(SXA)をインストールすると、Next.jsベースのJavaScriptサービス(JSS)アプリケーションが起動しなくなる可能性があります。 この事象の根本的な原因は、JSSテナントにデプロイされた通常のNext.jsアプリとNext.jsアプリのアイテムが、異なるテンプレートを参照していることです。
この事象はSitecore Headless Rendering 18.0.0で発生します。
この事象を解決するには、辞書サービス(samples\nextjs\src\lib\dictionary-service-factory.ts)とサイトマップ フェッチャー(samples\src\lib\sitemap-fetcher.ts)の両方のアプリ ルートを見つけるために使用されるデフォルトのテンプレートをオーバーライドしてください。
export class DictionaryServiceFactory { create(): DictionaryService {
return new RestDictionaryService({ apiHost: config.sitecoreApiHost,
apiKey: config.sitecoreApiKey,
siteName: config.jssAppName,
jssAppTemplateId: '{GUID}' // some valid GUID here });
}
}
```
this._graphqlSitemapService = new GraphQLSitemapService({ endpoint: config.graphQLEndpoint, apiKey: config.sitecoreApiKey, siteName: config.jssAppName, /* The Sitemap Service needs a root item ID in order to fetch the list of pages for the current app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here; otherwise, the service will attempt to figure out the root item for the current JSS App using GraphQL and app name. */ rootItemId: '{GUID}' }); ```