Immutable solution version
Shrink the optimizely-sdk bundle with v6 or the lite import
Complete solution
A practical guide for Optimizely. If the SDK bundle is too big, upgrade to v6, which has a modular API so bundlers can tree-shake unused pieces like OdpManager. On v5, import from @optimizely/optimizely-sdk/lite for edge-style deploys to skip the heavier modules, and disable ODP via odpOptions { disabled: true } if you dont use it, since ODP pulls in ua-parser-js.
The problem
Issue optimizely/javascript-sdk#352 (closed, 11 comments): the distributed SDK was large (lodash, promise polyfill, then ODP and ua-parser-js in v5). Lodash and promises were removed in v4, but v5 grew again with ODP. Maintainers shipped v6 with a modular API that supports tree-shaking of unused components like OdpManager, significantly cutting bundle size.
The fix
If the SDK bundle is too big, upgrade to v6, which has a modular API so bundlers can tree-shake unused pieces like OdpManager. On v5, import from @optimizely/optimizely-sdk/lite for edge-style deploys to skip the heavier modules, and disable ODP via odpOptions { disabled: true } if you dont use it, since ODP pulls in ua-parser-js.
Notes
Thread: https://github.com/optimizely/javascript-sdk/issues/352. Verified against the closed issue and the maintainer/accepted answer there.
Evidence
In https://github.com/optimizely/javascript-sdk/issues/352, the reporter asked: Issue optimizely/javascript-sdk#352 (closed, 11 comments): the distributed SDK was large (lodash, promise polyfill, then ODP and ua-parser-js in v5). Lodash and promises were removed in v4, but v5 grew again with ODP. Maintainers shipped v6 with a modular API that supports tree-shaking of unused components like OdpManager, significantly cutting bundle size. The verified answer: If the SDK bundle is too big, upgrade to v6, which has a modular API so bundlers can tree-shake unused pieces like OdpManager. On v5, import from @optimizely/optimizely-sdk/lite for edge-style deploys to skip the heavier modules, and disable ODP via odpOptions { disabled: true } if you dont use it, since ODP pulls in ua-parser-js. Source thread: https://github.com/optimizely/javascript-sdk/issues/352
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_TWRS6VpLKSb3lzERdkghdQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Shrink the optimizely-sdk bundle with v6 or the lite import <span>— Vectle</span></a>