【发布时间】:2021-07-04 22:05:59
【问题描述】:
它在本地工作。 但是,一旦我将它部署到 firebase 上,它会产生 nextServer 500 内部错误。
下一个-i18下一个版本
8.1.3
配置
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'ko'],
},
};
代码
_app.tsx
import { appWithTranslation } from 'next-i18next';
const App = ({ Component, pageProps }: AppProps): JSX.Element => {
return (
<Provider store={store}>
<MainWrapper>
<Component {...pageProps} />
</MainWrapper>
</Provider>
);
};
export default appWithTranslation(App);
关于 serverSideRendering 的代码 sn-ps
export const getStaticProps: any = async ({ locale }) => ({
props: {
...(await serverSideTranslations(locale, [])),
},
});
export const getServerSideProps: GetServerSideProps = async (context) => {
const { teamId, email } = context.query;
let teamName;
if (!teamId) {
return { props: {} };
}
if (teamId) {
teamName = await getTeamName(teamId as string);
}
return {
props: {
teamId,
teamName,
email: email || '',
...(await serverSideTranslations(context.locale, [])),
},
};
};
【问题讨论】:
-
你得到什么错误信息?
-
我有同样的错误
标签: next.js i18next next-i18next