fix(audience): bundle core subpath + support X/Google dedup - #2933
Merged
Conversation
The tsdown alwaysBundle list matched bare package names only, so the `@imtbl/audience-core/internal` subpath import leaked out as an external dependency in the published bundle. Because `@imtbl/audience-core` is private and never published (and prepack strips it from dependencies), `npm install @imtbl/audience` produced a package that fails to resolve `@imtbl/audience-core/internal` at runtime. Match subpaths too so the whole workspace dep is inlined.
Add x and google to DEDUP_CAPABLE_NETWORKS so trackConversion mints and stamps a shared conversion id for those visits. X dedups on conversion_id and Google on transaction_id/order_id, both keyed on the same client-minted value the postbacks builders reuse server-side.
|
View your CI Pipeline Execution ↗ for commit 2670531
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
✅ Audience Bundle Size — @imtbl/audience
Budget: 24.00 KB gzipped (warn at 20.00 KB) |
nattb8
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related audience-SDK changes.
1.
fix: bundle workspace-dep subpaths into the published packageRegression from #2928 (tsup → tsdown build migration, 2026-07-28). The audience build previously used tsup, whose
noExternal(fed the bare-nameBUNDLED_WORKSPACE_DEPSlist) inlined@imtbl/audience-coreand its subpaths. #2928 migrated the build to tsdown, moving the same bare-name list todeps.alwaysBundle— but tsdown's matcher only matches the bare package name, not subpaths. So the@imtbl/audience-core/internalimport (added harmlessly back in #2881, 2026-06-09) started leaking out as an external import.Because
@imtbl/audience-coreisprivate: true(never published) andprepackstrips it fromdependencies, the published package throwsMODULE_NOT_FOUNDfor@imtbl/audience-core/internalat runtime (jest, bundlers, any npm consumer).Affected releases: only
2.24.0and the2.23.1-0alpha (both published 2026-07-29, after the migration).2.23.0and earlier — built with tsup — resolve fine, which is why Playmain(pinned to2.23.0) is green and this only surfaced on the branch that bumped past the migration.Fix: derive
alwaysBundlematchers from the dep list as regexes that also match subpaths (^@imtbl/audience-core(/.*)?$), restoring the tsup behavior. tsdown accepts regex matchers (the CDN build already usesalwaysBundle: [/.*/]).2.
feat: support X and Google intrackConversiondedupAdd
xandgoogletoDEDUP_CAPABLE_NETWORKSsotrackConversionmints and stamps a shared conversion id for those visits. X dedups onconversion_id, Google ontransaction_id/order_id, both keyed on the same client-minted value the postbacks builders reuse server-side. This lets Game Page add X/Google pixels later with no further SDK coordination.Test plan
@imtbl/audiencetests passdist/{browser,node}/index.jshas no external@imtbl/audience-core/internalimport (inlined)