vite + vercel "you will need to pass in an i18next instance by using initReactI18next"
laclance opened this issue Β· comments
π Bug Report
To Reproduce
I have a vite and express application that was converted from a nextjs app, deployed to vercel with no issues with nextjs.
No issues locally after switching to vite but build fails when pushed to vercel with you will need to pass in an i18next instance by using initReactI18next
. I did also try just import './i18n'; without the I18nextProvider.
//i18n.ts
import i18next from 'i18next';
import { initReactI18next } from 'react-i18next';
import pos from 'locales/en/pos.json';
export const defaultNS = 'pos';
export const resources = { en: { pos } } as const;
const locizeOptions = {
projectId: '27e7261e-cd1f-42c9-8ad9-80ad6acaa08a',
referenceLng: 'en'
};
i18next.use(initReactI18next).init({
resources,
fallbackLng: 'en',
lng: 'en',
fallbackNS: 'pos',
defaultNS: 'pos',
ns: ['pos'],
saveMissing: true,
interpolation: {
escapeValue: false
},
backend: locizeOptions
});
export default i18next;
//main.tsx
import i18n from './i18n';
import { I18nextProvider } from 'react-i18next';
...
ReactDOM.createRoot(document.getElementById('root')!).render(
<StrictMode>
<I18nextProvider i18n={i18n}>
<RouterProvider router={router} />
</I18nextProvider>
</StrictMode>
);
Your Environment
node 18.18
"i18next": "^23.9.0",
"react-i18next": "^14.0.5",
please provide a minimal but complete example repository...
here some hints that may help:
https://stackoverflow.com/questions/67894982/react-i18next-you-will-need-to-pass-in-an-i18next-instance-by-using-initreacti
i18next/next-i18next#1917
#1594
Thank you, it seems vercel will not really work for our setup anyway but apps working fine on aws.