Skip to content

Mark the package as free of side effects - #538

Merged
marcospassos merged 1 commit into
masterfrom
mark-side-effect-free
Oct 14, 2026
Merged

marcospassos merged 1 commit into
masterfrom
mark-side-effect-free

Conversation

@marcospassos

Copy link
Copy Markdown
Member

Marks the package as free of side effects, so bundlers can drop modules that aren't used.

Without it, importing anything pulls in its whole dependency chain. For example, a plug-integrations plugin that only imports a constant ended up with ~3.5 KB of unused SDK modules (apiKey, help, constants).

I checked that no module relies on running code when imported: there are only class and schema definitions, and plug's GlobalPlug.GLOBAL singleton just creates a promise. Nothing downstream does side-effect-only imports like import '@croct/...'. Simulating the flag in plug-integrations gave identical bundles for everything else and the expected reduction for the Shopify plugin.

@pkg-pr-new

pkg-pr-new Bot commented Oct 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@croct/sdk@538

commit: f8094d8

@marcospassos marcospassos added the enhancement Improvement of existing features label Oct 14, 2026
@marcospassos
marcospassos merged commit 2655f24 into master Oct 14, 2026
8 of 9 checks passed
@marcospassos
marcospassos deleted the mark-side-effect-free branch October 14, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement of existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant