porscheofficial / cookie-consent-banner

The lightweight and flexible Cookie Consent Banner
MIT License
149 stars 6 forks source link

Package produces an error in older browser (ie. iOS Safari 12.4) #5

Closed manucoffin closed 2 years ago

manucoffin commented 2 years ago

Node/npm version(s): Node v14.18.0 / npm v6.14.15

Package(s) version(s):

    @porscheofficial/cookie-consent-banner-react@2.1.1

Browser(s) version(s): Safari iOS 12.4

Description of the issue/feature: Instantiating the component CookieConsentBanner results in an error:

Capture d’écran 2022-01-31 à 15 34 59

I suppose it comes from a js feature that is not supported by old browsers.

Some example to reproduce the issue: Unfortunately I am unable to reproduce the issue on codesandbox, sorry :/ To reproduce the issue, try to load the component in an old version of safari (ie. safari for iOS v12.4). You can use the iOS simulator for that.

Use cases:

pboeder commented 2 years ago

Hi @manucoffin!

Wow, iOS 12.4 is really not the most recent browser.

The reason for this error seems to be, that we have ESNEXT as target in our tsconfig and you don't transpile your node_modules. Would it work for you to just transpile your dependencies?

Additionally, I will look into, if we should also publish a derivate with a lower ecma version as target…

manucoffin commented 2 years ago

It is indeed very old, unfortunately we have to make it work on this version as well 🙃 It doesn't seem a good solution to me to transpile the dependencies, I'd rather go with a different cookies banner for this specific version

pboeder commented 2 years ago

Ok, sorry for that. As I said, I'll look into the target definitions and see if we might not transpile to a lower version. But will close this issue for now.