diff --git a/package.json b/package.json index 585a1cb9..d136f37e 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,16 @@ "default": "./dist/modern/index.cjs" } }, + "./purged": { + "import": { + "types": "./dist/modern/index.purged.d.ts", + "default": "./dist/modern/index.purged.js" + }, + "require": { + "types": "./dist/modern/index.purged.d.cts", + "default": "./dist/modern/index.purged.cjs" + } + }, "./package.json": "./package.json" }, "files": [ diff --git a/src/index.purged.ts b/src/index.purged.ts new file mode 100644 index 00000000..78f952e1 --- /dev/null +++ b/src/index.purged.ts @@ -0,0 +1,12 @@ +/** + * Purged entry: only the light SDK. Use this via resolve.alias in production + * to exclude the full SDK (edit button, Visual Builder) from the bundle. + * Same API as the main entry; no full HOC or DOM side effects. + */ +import { IStackSdk as ExternalStackSdkType } from "./types/types"; +import LightLivePreviewHoC from "./light-sdk"; + +export type IStackSdk = ExternalStackSdkType; + +export const VB_EmptyBlockParentClass = "visual-builder__empty-block-parent"; +export default LightLivePreviewHoC; diff --git a/src/livePreview/editButton/editButton.ts b/src/livePreview/editButton/editButton.ts index df88fc7d..d3cd0bfa 100644 --- a/src/livePreview/editButton/editButton.ts +++ b/src/livePreview/editButton/editButton.ts @@ -570,6 +570,12 @@ effect(function handleWindowTypeChange() { // we need to specify when to run this effect. // here, we run it when the value of windowType changes if (typeof window === "undefined") return; + if ( + typeof process !== "undefined" && + (process?.env?.PURGE_PREVIEW_SDK === "true" || + process?.env?.REACT_APP_PURGE_PREVIEW_SDK === "true") + ) + return; Config.get().windowType; if (LivePreviewEditButton && !isOpeningInTimeline()) { toggleEditButtonElement();