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

2.7.0 causes project build failure #160

Closed hellohejinyu closed 1 day ago

hellohejinyu commented 1 day ago

🐛 Bug Report

x Build failed in 16.33s
error during build:
[vite:esbuild-transpile] Transform failed with 1 error:
assets/index-!~{001}~.js:32428:16: ERROR: Top-level await is not available in the configured target environment ("chrome64", "edge79", "es2020", "firefox67", "safari12" + 2 overrides)

Top-level await is not available in the configured target environment ("chrome64", "edge79", "es2020", "firefox67", "safari12" + 2 overrides)
32426|  if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
32427|    try {
32428|      fetchApi = (await __vitePreload(async () => { const {default: __vite_default__} = await import('./browser-ponyfill-!~{00j}~.js').then(n => n.b);return { default: __vite_default__ }},true?__VITE_PRELOAD__:void 0)).default;
   |                  ^
32429|    } catch (e) {}
32430|  }

    at failureErrorWithLog (/Users/Jinyu/WorkCodes/ourschool-ai/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:1472:15)
    at /Users/Jinyu/WorkCodes/ourschool-ai/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:755:50
    at responseCallbacks.<computed> (/Users/Jinyu/WorkCodes/ourschool-ai/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:622:9)
    at handleIncomingPacket (/Users/Jinyu/WorkCodes/ourschool-ai/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:677:12)
    at Socket.readFromStdout (/Users/Jinyu/WorkCodes/ourschool-ai/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/lib/main.js:600:7)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
 ELIFECYCLE  Command failed with exit code 1.

🙏

It seems like the issue is caused by the top-level await syntax not being supported in older browsers. I'm really sorry, but due to my busy schedule, I can't provide a minimal reproducible demo. I'm just raising this issue to let you know about the problem.

adrai commented 1 day ago

https://github.com/i18next/i18next-http-backend/issues/158