aldabil21 / next13-i18n

Just testing i18n with next13
1 stars 4 forks source link

Error i18next-fs-backend #1

Open Robin-Gustafsson opened 1 year ago

Robin-Gustafsson commented 1 year ago

Hi, tried you solution but got this error on build. Any thoughts?

Using node version ^16

Failed to compile.

./node_modules/i18next-fs-backend/esm/readFile.js Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime Used by readFileSync, readFile Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

Import trace for requested module: ./node_modules/i18next-fs-backend/esm/readFile.js ./node_modules/i18next-fs-backend/esm/index.js ./i18n/index.ts Build failed because of webpack errors

Skärmavbild 2022-11-14 kl  13 29 40

aldabil21 commented 1 year ago

Hi

yeah this would happen if you try to use the t or any i18n functions in a client component. If you have use client in the component or a parent component, you will face this error.

I wouldn't call this repo as "solution", consider it just fiddling around trying Next 13 with i18n. The real solution should come from Next team here, https://github.com/vercel/next.js/issues/41980

Robin-Gustafsson commented 1 year ago

Thanks! Sorry I missed that part. I've tried your solution with Storyblok and it works well in the dev environment.

Looking forward to find a way to get i18n working with Next 13 Server components.

nextjs13-i18n-storyblok