bi
Builder.io
OSS
bi
Pipelines
Nx runs
Insights
Compare tasks
Analytics
Sign in
Toggle Sidebar
bi
@builder.io/sdks
Pipelines
fix: publish custom event polyfill (#4777) ## 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 - [x] 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` - [x] 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 <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 726f9c69df33d3622f7eb6a7b4486a70c0fd855e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
nx test @e2e/angular-17
⌘K
fix: publish custom event polyfill (#4777)
Succeeded
in
9m 49s
Started
Linux
4 CPU cores
read-write
access token used
Copy command
nx test @e2e/angular-17
main
46dd7ba
GitHub
Open on GitHub
Tasks
Resource Usage
bi
Builder.io
OSS