Skip to content

fix: publish custom event polyfill - #4777

Open
davilima6 wants to merge 2 commits into
BuilderIO:mainfrom
davilima6:fix/publish-custom-event-polyfill
Open

fix: publish custom event polyfill#4777
davilima6 wants to merge 2 commits into
BuilderIO:mainfrom
davilima6:fix/publish-custom-event-polyfill

Conversation

@davilima6

@davilima6 davilima6 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Purpose

Ensure the custom event polyfill referenced by the SDK's generated declarations is included in the published package.

> tsc --noEmit

../../node_modules/.pnpm/@builder.io+sdk@6.3.1_encoding@0.1.13/node_modules/@builder.io/sdk/dist/src/bu
ilder.class.d.ts:2:8 - error TS2882: Cannot find module or type declarations for side-effect import of
'./polyfills/custom-event-polyfill'.

2 import './polyfills/custom-event-polyfill';
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in ../../node_modules/.pnpm/@builder.io+sdk@6.3.1_encoding@0.1.13/node_modules/@builder.i
o/sdk/dist/src/builder.class.d.ts:2

 ELIFECYCLE  Command failed with exit code 1.
ERROR: command (/Users/me/Projects/mypackage/apps/mcp-server) /Users/me/Library/p
npm/.tools/pnpm/10.4.1/bin/pnpm run check:types exited (1)
└─ @myorg/my-pkg#check:types ──

Approach and changes

  • converted the custom event polyfill from JS to TS so the existing SDK compiler emits its runtime module and empty declaration alongside builder.class.d.ts
  • preserved the browser fallback behavior: it only defines window.CustomEvent when it is missing

Testing instructions

  1. Run yarn workspace @builder.io/sdk build
  2. Confirm that packages/core/dist/src/polyfills/custom-event-polyfill.js and packages/core/dist/src/polyfills/custom-event-polyfill.d.ts exist
  3. In a TS consumer that enables noUncheckedSideEffectImports, import @builder.io/sdk and run tsc --noEmit. The declaration import of ./polyfills/custom-event-polyfill should resolve

Note

Low Risk
Small packaging and typing fix for an existing browser polyfill with no auth, data, or API behavior changes.

Overview
Fixes a published package gap where builder.class.d.ts side-effect-imports ./polyfills/custom-event-polyfill, but consumers running tsc --noEmit (especially with strict side-effect import checks) could not resolve that module.

The polyfill is now TypeScript so the SDK build emits custom-event-polyfill.js and a matching .d.ts next to the generated declarations. Runtime behavior is unchanged: the IIFE still only patches window.CustomEvent when it is missing in the browser.

Reviewed by Cursor Bugbot for commit 726f9c6. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 726f9c6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@builder.io/sdk Patch
@builder.io/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nx-cloud

nx-cloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 726f9c6

Command Status Duration Result
nx test @snippet/react ❌ Failed 5m 27s View ↗
nx test @e2e/qwik-city ✅ Succeeded 10m 4s View ↗
nx test @e2e/nextjs-sdk-next-app ✅ Succeeded 9m 38s View ↗
nx test @e2e/angular-17 ✅ Succeeded 9m 3s View ↗
nx test @e2e/react-sdk-next-15-app ✅ Succeeded 7m 39s View ↗
nx test @e2e/nuxt ✅ Succeeded 5m 17s View ↗
nx test @e2e/hydrogen ✅ Succeeded 7m 17s View ↗
nx test @e2e/angular-17-ssr ✅ Succeeded 7m 43s View ↗
Additional runs (37) ✅ Succeeded ... View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-08-04 20:45:02 UTC

@davilima6
davilima6 marked this pull request as ready for review August 5, 2026 06:14
@builder-io-integration

Copy link
Copy Markdown
Contributor

Review Agent skipped this PR — @davilima6 doesn't have a Builder seat in this space.

If you're @davilima6: you may already have a seat under a different GitHub account. Reconnect GitHub

If you're an admin: Add @davilima6 to this space

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

1 participant