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

Module not found: Can't resolve 'encoding' in '.../node_modules/node-fetch/lib' #118

Closed michalvadak closed 1 year ago

michalvadak commented 1 year ago

🐛 Bug Report

When using 18next-http-backend with NextJS 13 the console is throwing this error.

Module not found: Can't resolve 'encoding' in '.../node_modules/node-fetch/lib'
Import trace for requested module:
../../node_modules/node-fetch/lib/index.js
../../node_modules/cross-fetch/dist/node-ponyfill.js
../../node_modules/i18next-http-backend/esm/getFetch.cjs
../../node_modules/i18next-http-backend/esm/request.js
../../node_modules/i18next-http-backend/esm/index.js
../../libs/shared/feature/localization/src/lib/server.ts
../../libs/shared/feature/localization/src/server.ts
./app/[lng]/layout.tsx

To Reproduce

Create NextJS 13 with app directory and setup i18next with i18next-http-backend

Temporary workaround

yarn add -D encoding

Your Environment

adrai commented 1 year ago

Can you please provide a minimal reproducible example? Are you using it on client side or on server side?

michalvadak commented 1 year ago

https://codesandbox.io/p/sandbox/laughing-northcutt-2r3849?file=%2Fapp%2Fi18n%2Fsettings.ts%3A17%2C9

I'm using it on server side

adrai commented 1 year ago

Seems to be a Next.js specific problem: https://github.com/vercel/next.js/issues/7621

adrai commented 1 year ago

There's not much we can do here, sorry.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.