如何使用 next.config.js 中的 pwa 和 i18n 模块在 Next js 上离线运行 PWA?

时间:2021-07-19 11:50:44

标签: next.js progressive-web-apps i18next

当我离线运行 PWA 时遇到问题,我得到一个空页面。但是,如果我删除 next.config.js 中的 nextTranslate 模块,它将正常工作。但我想使用 Next.js 路由哪些语言环境和 SSR。如何让它协同工作?

next.config.js

const nextTranslate = require('next-translate')
const withPWA = require('next-pwa')
const runtimeCaching = require('next-pwa/cache')

module.exports = withPWA({
  ...nextTranslate(),
  pwa: {
    dest: 'public',
    runtimeCaching,
  },
})

package.json

{
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "next": "latest",
    "next-pwa": "^5.2.24",
    "next-translate": "^1.0.7",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  }
}

0 个答案:

没有答案