Flagsmith / flagsmith-js-client

Javascript Client for Flagsmith. Ship features with confidence using feature flags and remote config. Host yourself or use our hosted version at https://www.flagsmith.com/

Home Page:https://www.flagsmith.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for manifest 3?

akaradzic-scribe opened this issue · comments

Hi,
We are using flagsmith in the web application and on the extension. So far everything was working great, but now we are migrating our extension to manifest v3 and I am getting the error ReferenceError: XMLHttpRequest is not defined.
Are you planning to support manifest v3 or is there some workaround for this error?
Screenshot 2022-10-20 at 15 04 36

We traced this error flagsmith-core.js.
In manifest v3 XMLHttpRequest is not supported.

Hi @akaradzic-scribe - thanks for raising this issue - can you just confirm that you are only seeing ReferenceError: XMLHttpRequest is not defined in a chrome extension? Is it just Chrome that is affected?

Hi @akaradzic-scribe, we've had cases like this before in other frameworks such as nuxt where xmlhttp / fetch isn't defined.

As a result, the SDK lets you provide a custom fetch implementation. I imagine you can just provide node-fetch as the implementation will solve your problem. An example of this is done here.

https://github.com/Flagsmith/flagsmith-js-client/blob/main/examples/nuxt/plugins/flagsmith-plugin.ts#L9

@kyle-ssg Thanks so much for your prompt response. This solved my problem. I suppose it would be very helpful for other folks if you updated your documentation with this information.

Noted, thank you for getting back to me @akaradzic-scribe, I'll keep this open and add some documentation today before I close this.