Next-translate: 馃悶| 鈦夛笍 TypeError: Cannot read property 'getInitialProps' of undefined

Created on 18 Apr 2020  路  3Comments  路  Source: vinissimus/next-translate

Issue

Whenever I am wrapping my page lets say pages_/login.tsx with a Context and Provider, I get this error.

```> Build error occurred
TypeError: Cannot read property 'getInitialProps' of undefined

So the question is, how can I still be able to use my custom context and wrap my pages with without getting this error on `yarn build`

The error is located in here

if(C.getInitialProps) {
Page.getInitialProps = ctx => C.getInitialProps({ ...ctx, lang: 'de'})
}

But if I add 

if(C && C.getInitialProps)
....
```
the issue gets fixed, but this is not a since pages are dynamically created.

bug

All 3 comments

Ok, this should be fixed! Thanks to report it!

@OmarZeidan this will be solved on 0.15.0. Feel free to reopen if it still happening.

@aralroca Great to hearing that. Thanks and will def do.

Was this page helpful?
0 / 5 - 0 ratings