Next.js: _document.js-TypeError:无法读取未定义的属性“ map”

创建于 2017-04-29  ·  6评论  ·  资料来源: vercel/next.js

nextjs:版本2.2.0

当我使用_document.js类的文档时。 我有这个问题。 有什么解决方案吗?

我使用_document.js尝试了一些示例。 还是一样

最有用的评论

当nextjs版本为2.3-alpha1时,将发生此问题,
当2.2.0时工作良好

所有6条评论

@ nndung179是否可以进行回购,以供我们复制?

节点版本:6.5.0
@arunoda

这是一个例子:

https://github.com/zeit/next.js/tree/master/examples/with-external-scoped-css

@arunoda我使用“ next”尝试此示例:“ 2.2.0”工作正常。

captura de pantalla 2017-04-30 a las 9 23 44

但是使用“ next”:“ latest”,安装“ 2.3.0-alpha1”,并且容易失败。

captura de pantalla 2017-04-30 a las 9 27 59

在_document.js中添加它可以正常工作。 资源
javascript
静态getInitialProps({renderPage}){
const {html,head,chunks} = renderPage()
返回{html,head,chunks}
}

当nextjs版本为2.3-alpha1时,将发生此问题,
当2.2.0时工作良好

我认为这与此相同: https :
始终尝试为自定义文档的getInitialProps添加正确的内容。 (始终参考文档)

或使用此:

import Document from `next/document`

static getInitialProps (ctx) {
   return Document.getInitialProps(ctx)
}
此页面是否有帮助?
0 / 5 - 0 等级

相关问题

sospedra picture sospedra  ·  3评论

flybayer picture flybayer  ·  3评论

formula349 picture formula349  ·  3评论

irrigator picture irrigator  ·  3评论

knipferrc picture knipferrc  ·  3评论