From 3aff213ed23464b383f117dcea4262e9b9230c18 Mon Sep 17 00:00:00 2001 From: Addy Pathania Date: Thu, 4 Jan 2024 12:59:12 -0500 Subject: [PATCH] fix double registeration of byoc components --- .../src/lib/next-config/plugins/feaas.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/create-sitecore-jss/src/templates/nextjs-xmcloud/src/lib/next-config/plugins/feaas.js b/packages/create-sitecore-jss/src/templates/nextjs-xmcloud/src/lib/next-config/plugins/feaas.js index 1cb6b91c3f..6731497e0a 100644 --- a/packages/create-sitecore-jss/src/templates/nextjs-xmcloud/src/lib/next-config/plugins/feaas.js +++ b/packages/create-sitecore-jss/src/templates/nextjs-xmcloud/src/lib/next-config/plugins/feaas.js @@ -8,7 +8,14 @@ const feaasPlugin = (nextConfig = {}) => { // Force use of CommonJS on the server for FEAAS SDK since JSS also uses CommonJS entrypoint to FEAAS SDK. // This prevents issues arising due to FEAAS SDK's dual CommonJS/ES module support on the server (via conditional exports). // See https://nodejs.org/api/packages.html#dual-package-hazard. - config.externals = [{ '@sitecore-feaas/clientside/react': 'commonjs @sitecore-feaas/clientside/react' }, ...config.externals]; + config.externals = [ + { + '@sitecore-feaas/clientside/react': 'commonjs @sitecore-feaas/clientside/react', + '@sitecore/byoc': 'commonjs @sitecore/byoc', + '@sitecore/byoc/react': 'commonjs @sitecore/byoc/react', + ...config.externals, + }, + ]; } // Overload the Webpack config if it was already overloaded @@ -17,7 +24,7 @@ const feaasPlugin = (nextConfig = {}) => { } return config; - } + }, }); };