使用 next-translate 打开动态页面的时间太长

问题描述 投票:0回答:0

在vercel上用next-translate部署项目时,第一次打开像[id].js这样的动态页面很长。例如:

 src/pages/users/index.tsx
 src/pages/users/[userId].tsx
next-translate - compiled page: /users - locale: en - namespaces: translation - used loader: getStaticProps
next-translate - compiled page: /users/[userId] - locale: en - namespaces: translation - used loader: getServerSideProps
"next": "^12.3.4",
"next-translate": "^2.0.5",
"react": "^17.0.2",
"next-translate-plugin": "^2.0.5"
Node: 18
npm v8.19.3

我的 next.config.js:

const nextTranslate = require('next-translate-plugin');
module.exports = nextTranslate({
  webpack: (config, options) => {
    //....
    return config;
  },
});

i18n.js

module.exports = {
  locales: ['default','de','en'],
  defaultLocale: 'default',
  localeDetection: false,
  defaultNS: 'translation',
  keySeparator: ':',
  pages: {
    '*': ['translation'],
  },
  loadLocaleFrom: async (locale, namespace) => {
    const localesUrl = `.....json`;
    //....
  },
  serializeConfig: false,
};
javascript reactjs next.js i18next next-translate
© www.soinside.com 2019 - 2024. All rights reserved.