Skip to content

perf(org-browser): resolve effect ESM to shrink bundle (POC) - W-23293744#7675

Merged
mshanemc merged 7 commits into
developfrom
sm/W-23293744-poc-shrink-org-browser-bundle-via-esbuil
Jul 6, 2026
Merged

perf(org-browser): resolve effect ESM to shrink bundle (POC) - W-23293744#7675
mshanemc merged 7 commits into
developfrom
sm/W-23293744-poc-shrink-org-browser-bundle-via-esbuil

Conversation

@mshanemc

@mshanemc mshanemc commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • POC: esbuild resolves effect's ESM build (conditions:['import','module','default']) instead of CJS for org-browser, letting the tree-shaker drop most of the bundled fast-check dependency.
  • Node dist/index.js: 1,447,135B → 698,929B (-51.7%); fast-check bytesInOutput 234,890B → 47,189B (-79.9%).
  • Web dist/web/index.js: 1,422,362B → 719,525B (-49.4%); fast-check bytesInOutput 223,587B → 51,876B (-76.8%). Output stays CJS (no import.meta/ESM syntax leaked). Change scoped locally to org-browser; shared bundling config (16 consumers) left untouched pending follow-up WI.

Plan

.claude/plans/W-23293744.md

What issues does this PR fix or reference?

@W-23293744@


🤖 Generated by auto-build pipeline. Original WI: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002dnRRSYA2/view

mshanemc and others added 7 commits July 2, 2026 15:53
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Baseline (effect resolves dist/cjs/*):
- node dist/index.js = 1,447,135B; fast-check bytesInOutput = 234,890B
- web dist/web/index.js = 1,422,362B; fast-check bytesInOutput = 223,587B

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…293744

Add conditions:['import'] to node + browser esbuild configs (local override)
so effect resolves dist/esm/* instead of dist/cjs/*, letting the tree-shaker
drop most of fast-check (pulled in unconditionally by cjs Schema.js).

Measured (output format stays CJS; no import.meta / ESM syntax in output):
- effect resolution: dist/cjs/* -> dist/esm/*
- node dist/index.js: 1,447,135B -> 698,929B (-51.7%)
  fast-check bytesInOutput: 234,890B -> 47,189B (-79.9%)
- web dist/web/index.js: 1,422,362B -> 719,525B (-49.4%)
  fast-check bytesInOutput: 223,587B -> 51,876B (-76.8%)

fast-check reduced ~80%, NOT eliminated (effect/FastCheck.js barrel
re-export + reachable fastCheck_.array in nonEmptyChunkArbitrary).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Verdict ACHIEVED, local-only. Node bundle 1,447,135B -> 698,929B (-51.7%),
web 1,422,362B -> 719,525B (-49.4%); fast-check ~80% reduced (not eliminated).
Both Playwright suites green. Shared-config promotion deferred to follow-up WI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extract shared effectEsmOverride spread into node + browser builds (was
hand-copied conditions line in both). Use conditions:['import','module',
'default'] matching visualforce for fallback robustness. Clarify comment:
cjs output format comes from shared configs, not this file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…g - W-23293744

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mshanemc mshanemc marked this pull request as ready for review July 2, 2026 23:13
@mshanemc mshanemc requested a review from a team as a code owner July 2, 2026 23:13
@mshanemc mshanemc requested a review from daphne-sfdc July 2, 2026 23:13
@mshanemc

mshanemc commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

/ai-auto approve

@mshanemc mshanemc removed the request for review from daphne-sfdc July 4, 2026 14:32

@peternhale peternhale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer-approved on behalf of @mshanemc per /ai-auto approve

@mshanemc mshanemc merged commit 989283d into develop Jul 6, 2026
64 checks passed
@mshanemc mshanemc deleted the sm/W-23293744-poc-shrink-org-browser-bundle-via-esbuil branch July 6, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants