Skip to content

fix(checkout-sdk): preserve webpackIgnore for widgets CDN import - #2937

Merged
lfportal merged 2 commits into
mainfrom
fix/checkout-sdk-webpack-ignore-widgets
Jul 31, 2026
Merged

fix(checkout-sdk): preserve webpackIgnore for widgets CDN import#2937
lfportal merged 2 commits into
mainfrom
fix/checkout-sdk-webpack-ignore-widgets

Conversation

@alex-connolly

@alex-connolly alex-connolly commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Customer Impact

Restores checkout.widgets() for webpack/Vite apps broken since @imtbl/checkout-sdk@2.24.0 (Send drawer / all widget types fail with "Failed to load widgets script" and no network request).

Summary

  • Disable rolldown minify/mangle in checkout-sdk builds so /* webpackIgnore: true */ survives packaging
  • Build the widgets CDN URL via .join('') so the specifier is not folded into a template-literal import()

Bundle size delta (dist/browser/index.js)

Version raw gzip
2.24.1 (mangle on, broken) ~99 KB ~28 KB
2.23.0 (last good) ~158 KB ~38 KB
this PR (minify: false) ~204 KB ~43 KB

vs current latest: ~+105 KB raw / ~+15 KB gzip. vs last good: ~+46 KB raw / ~+5 KB gzip. Acceptable for an SDK that app bundlers typically minify again.

Changes

  • Fixed

Test plan

  • pnpm --filter @imtbl/checkout-sdk build
  • Dist contains webpackIgnore: true and does not use import(\https://cdn.jsdelivr.net/...`)`
  • After publish of 2.24.2, Play (or a webpack consumer) can open Send / widgets without MODULE_NOT_FOUND
  • Spot-check Swap or Bridge (same checkout.widgets() path)

Rolldown mangling stripped the magic comment and inlined the CDN URL,
so webpack replaced checkout.widgets() with a MODULE_NOT_FOUND stub.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alex-connolly
alex-connolly requested a review from a team as a code owner July 31, 2026 04:59
lfportal
lfportal previously approved these changes Jul 31, 2026
@nx-cloud

nx-cloud Bot commented Jul 31, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 1c942c9

Command Status Duration Result
nx affected -t build,test ✅ Succeeded 1m 35s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-31 05:09:30 UTC

Rely on minify: false as the durable fix; a dist string scrape in build
is brittle and does not exercise the real webpack failure mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lfportal
lfportal added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 7014732 Jul 31, 2026
7 checks passed
@lfportal
lfportal deleted the fix/checkout-sdk-webpack-ignore-widgets branch July 31, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants