-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Is your feature request related to a problem? Please describe.
I am using react-sdk-components to embed Pega views inside a non-pega Portal, but when importing from either react_pconnect.jsx or sdk_component_map.js, my bundle-size balloons to over 1.5 MB (Minified). From what I can tell, this is because sdk-pega-component-map.js and all components on that map are loaded unconditionally- whether a given component is or is not available on the sdk-content-server, or on the local component map.
Am I doing something wrong here? If not, can either alternate options be made available?
Describe the solution you'd like
This is not strictly what I want to happen, but merely one way to solve this issue.
If in sdk-pega-component-map.js, the following:
import SomeComponent from './SomePath/SomeComponent.jsx';
const pegaSdkComponentMap = {
'SomeComponent': SomeComponent,
...,
}Were changed to something like:
import { lazy } from 'react';
const pegaSdkComponentMap = {
'SomeComponent': lazy(() => import('./SomePath/SomeComponent.jsx')),
...,
}Only components that are not available from the SDK content server and the local component map would be loaded.
Describe alternatives you've considered
Outside of not using the sdk-component-map and react_pconnect, I dont think there are any alternatives(?).
A colleague of mine did notice that the (not embedded) Portal does not have this same issue, and instead appears to load components as needed.
Additional context
Add any other context or screenshots about the feature request here.