i18next / i18next-http-backend

i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
MIT License
452 stars 70 forks source link

Version 2.7.0 introduced a breaking change - top-level await. Changelog says it should have been released as 3.0.0 #161

Closed Platonn closed 1 day ago

Platonn commented 1 day ago

🐛 Bug Report

After installing the latest v2.7.0 (released ~18h ago), while building an Angular app in a mode that doesn't support top-level await, I'm getting an error:

Application bundle generation failed. [9.305 seconds]
✘ [ERROR] Top-level await is not available in the configured target environment ("chrome129.0", "edge129.0", "firefox115.0", "ios17.0", "safari17.0" + 5 overrides)
  node_modules/i18next-http-backend/esm/request.js:83:16:
   83 │   fetchApi = (await import('cross-fetch')).default;

Expected behavior

Ideally such a breaking change shouldn't land in a minor release, but only a major. I can see in the changelog https://github.com/i18next/i18next-http-backend/blob/8d8bf8d/CHANGELOG.md there is no mention about 2.7.0 but only 3.0.0.

So I guess it was meant to be released as a major.

If yes, I guess 2.7.0 should be unpublished withing 72h from the release from NPM? Or a patch 2.7.1 (with a revert of the latest commit) should be released? - more safe option IMHO.

PS. Many thanks for your library 🙌

Chousse commented 1 day ago

yep pretty same behavior with a webpack compilation : WARNING in ./node_modules/i18next-http-backend/esm/request.js The generated code contains 'async/await' because this module is using "topLevelAwait". However, your target environment does not appear to support 'async/await'. As a result, the code may not run as expected or may cause runtime errors.

my config : "i18next": "^23.16.8", "i18next-http-backend": "^2.7.0", "webpack": "^5.94.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.1.0"

brtvcl commented 1 day ago

Downgrading to 2.6.2 worked for me as a temporary solution

HammadMomin commented 1 day ago

image i am also facing the same issue already tried downgrading to version 2.6.2 but its not helping and even tried 3.0.0 but its not resolved, any temp resolution for this please let me know @adrai

Platonn commented 1 day ago

I can see now the version 2.7.0 has been unpublished just now. So no longer a problem for us. image

Many thanks the library maintainers, for a quick reaction 🙌

adrai commented 1 day ago

fyi: I did not know before releasing, the default vite settings has problems with that... tested with react, etc... but not with vite default settings. That's why I did not a major bump.

v2.7.0 was already "depredcated" (unpublish is not possible anymore on npm) on npm.

https://github.com/i18next/i18next-http-backend/pull/144

now also a v2.7.1 was published (same as v2.6.2)

adrai commented 1 day ago

I can see now the version 2.7.0 has been unpublished just now. So no longer a problem for us. image

Many thanks the library maintainers, for a quick reaction 🙌

fyi: v2.7.0 was deprecated a couple of hours ago

Platonn commented 1 day ago

No worries at all. Many thanks again for your quick help 🙌

adrai commented 23 hours ago

fyi: v3.0.1 tries to remove the top-level await - if someone wants to try...

Explorer-Carbon commented 22 hours ago

fyi: v3.0.1 tries to remove the top-level await - if someone wants to try...

v3.0.1 runs without issues with vite@5.4.11 using the default build target (Chrome 87).