Closed defjosiah closed 4 years ago
Hi defjosiah,
Thanks for filing this issue. We’ve released version 3.2.2 containing the fix you referenced (from https://github.com/optimizely/javascript-sdk/pull/289). This should make the browser entry point usable as long as you pass in a custom event dispatcher. Hope this helps - please let us know.
Just upgraded to v3.2.2, and deployed successfully, thanks for the quick turnaround!
What I wanted to do
I would like to use the optimizely-sdk in a cloudflare worker (have been emailing/talking to @asaschachar about this use-case). Specifically, need the ability to:
What I expected to happen
Add imports to @optimizely/optimizely-sdk, bundle with webpack, able to use the sdk in cloudflare workers.
What actually happened
The sdk failed when using the node version, because it couldn't find the Buffer object. The sdk failed when using the browser version, because it couldn't find "localStorage".
Steps to reproduce
optimizely-sdk: v3.2.0 webpack.config.js
Attempted various alias'es for the Buffer module, and a polyfill (npm install buffer), but it unfortunately doesn't work.
webpack.config.js
This version technically "works", as in, it'll assign a feature (haven't checked if the activate calls are going through to our custom dispatcher, I'd guess that they aren't going through, because this happens in sendPendingEvents).
@optimizely/optimizely-sdk
version:3.2.0Browser and version: Cloudflare Workers Environment
node
version: 10.15.3webpack
version: 4.29.6