react-i18next: `next export` doesn't work on next.js/examples/with-react-i18next

Hi, thank you for great library! I found with-react-i18next in next.js repository doesn’t work with next export. Another example, with-i18next is able to next export though.

$ node -v
v10.8.0
$ npm -v
6.3.0
$ npx create-next-app --example with-react-i18next with-react-i18next-app 
$ cd with-react-i18next-app
$ npm run build
$ npx next export
> using build directory: /path/to/with-react-i18next-app/.next
  copying "static build" directory
> No "exportPathMap" found in "next.config.js". Generating map from "./pages"
> exporting path: /index
> exporting path: /page2
TypeError: Cannot set property 'toJSON' of undefined
    at I18n.module.exports.i18n.getInitialProps (/path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:129:19)
    at Function._callee$ (/path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:286:92)
    at tryCatch (/path/to/with-react-i18next-app/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/path/to/with-react-i18next-app/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/path/to/with-react-i18next-app/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:245:221)
    at _next (/path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:245:409)
    at /path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:245:477
    at new Promise (<anonymous>)
    at Function.<anonymous> (/path/to/with-react-i18next-app/.next/server/bundles/pages/page2.js:245:97)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 28 (15 by maintainers)

Most upvoted comments

ok, I’ll have a look today

@littletower could you try with the sample here - and add the changes by @nhducit needed to get export to work…i guess it should work on that sample as i had issues with the original one published on the next.js repo too.