The published @polymarket/client ships as a tsup-prebundled dist/ where every import path — the root, /actions, /viem — funnels through one monolithic shared chunk (dist/chunk-*.js, ~147KB unminified) that contains perps, RFQ/combos and websocket-subscription logic alongside the auth/approvals code.
Measured in our production build (Vite/Rolldown, but the mechanism is bundler-independent): using only createSecureClient, credential handling and the trading-approvals actions, we still ship 162KB minified / 44KB gzip of the client — ~80% of that shared chunk — with perps identifiers (perpsDepositContract, perpsSubscriptions, ArmPerpsAutoCancelError, combo types, …) surviving dead-code elimination into the final bundle. Subpath imports don't help because the subpaths re-export from the same chunk; /actions is a flat 150+-name barrel resolving into it.
Ask: publish with sideEffects: false and real per-module ESM output (preserveModules or equivalent), and/or split perps/RFQ into their own entry point or package — so consumers touching only the auth/trading surface don't pay for the rest. Happy to provide the full byte-attribution breakdown if useful.
The published
@polymarket/clientships as a tsup-prebundleddist/where every import path — the root,/actions,/viem— funnels through one monolithic shared chunk (dist/chunk-*.js, ~147KB unminified) that contains perps, RFQ/combos and websocket-subscription logic alongside the auth/approvals code.Measured in our production build (Vite/Rolldown, but the mechanism is bundler-independent): using only
createSecureClient, credential handling and the trading-approvals actions, we still ship 162KB minified / 44KB gzip of the client — ~80% of that shared chunk — with perps identifiers (perpsDepositContract,perpsSubscriptions,ArmPerpsAutoCancelError, combo types, …) surviving dead-code elimination into the final bundle. Subpath imports don't help because the subpaths re-export from the same chunk;/actionsis a flat 150+-name barrel resolving into it.Ask: publish with
sideEffects: falseand real per-module ESM output (preserveModules or equivalent), and/or split perps/RFQ into their own entry point or package — so consumers touching only the auth/trading surface don't pay for the rest. Happy to provide the full byte-attribution breakdown if useful.