Skip to content

Conversation

@faiqamin
Copy link
Contributor

@faiqamin faiqamin commented Aug 25, 2025

Description / Motivation

  1. import-map
  • Disabled generation on Rendering Host: sitecore.config.ts sets disableCodeGeneration based on editingSecret (from SITECORE_EDITING_SECRET).
  • Removed from client bundles on Rendering Host: next.config.js uses client-only resolve.alias = false for .sitecore/import-map and an IgnorePlugin to block deep imports, enabling dead-code elimination.
  1. design library
  • Removed from Rendering Host bundles: next.config.js uses client-only resolve.alias = false for @sitecore-content-sdk/react/dist/esm/components/DesignLibrary and @sitecore-content-sdk/nextjs/editing, plus an IgnorePlugin for deep imports. The component-props loader remains minimal (only strips getComponentServerProps), with the bundle stripping handled by the config.
  • Kept for Editing Host: Layout.tsx renders DesignLibrary and loads .sitecore/import-map only when scConfig.isEditingHost is true.
  1. api/render endpoint
  • Emitted only for Editing Host: next.config.js removes src/pages/api/editing before Next.js route discovery when SITECORE_EDITING_SECRET is not set (Rendering Host), and adds the editing rewrite only when Editing Host.
  1. feaas endpoint
  • Same as above: the FEAAS builder route under /api/editing/feaas/render is removed for Rendering Host via pre-scan deletion, and its rewrite is added only for Editing Host.

Testing Details

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

- Added environment variable for NEXT_PUBLIC_EDITING_HOST to enable build-time dead-code elimination.
- Updated API routes to conditionally handle requests based on the editing host environment.
- Modified Layout component to load import map only when in editing mode.
- Adjusted Sitecore CLI configuration to disable code generation when editing host is active.
@github-actions
Copy link

github-actions bot commented Aug 25, 2025

📦 Package Size and Test Coverage Report

Package Base Size PR Size Δ Change Base Coverage PR Coverage Δ Change
cli 38.13 KB 38.13 KB ✅ 0.00 KB 57.42% 57.42% 0.00%
core 372.67 KB 372.78 KB 🔺 +0.11 KB 93.69% 93.69% 0.00%
create-content-sdk-app 148.23 KB 151.63 KB 🔺 +3.40 KB 96.22% 96.22% 0.00%
nextjs 324.77 KB 325.27 KB 🔺 +0.50 KB 89.42% 89.40% -0.03%
react 181.57 KB 181.57 KB ✅ 0.00 KB 92.17% 92.17% 0.00%
Total 🔺 +4.01 KB

faiqamin and others added 4 commits August 26, 2025 01:08
- Introduced `isEditingHost` flag derived from the `SITECORE_EDITING_SECRET` environment variable for consistent handling across components.
- Updated `next.config.js` to conditionally remove editing API routes for Rendering Hosts.
- Modified `Layout` component to utilize the new `isEditingHost` flag for loading import maps.
- Added new API routes for handling requests from Sitecore Editor and Component Builder.
- Adjusted Sitecore configuration to propagate the editing host flag to the Next.js layer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants