Next.js: _document.js-TypeError : μ •μ˜λ˜μ§€ μ•Šμ€ '맡'속성을 읽을 수 μ—†μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  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에 μΆ”κ°€ν•˜λ©΄ μ •μƒμ μœΌλ‘œ μž‘λ™ν•©λ‹ˆλ‹€. 좜처
```μžλ°” 슀크립트
static getInitialProps ({renderPage}) {
const {html, head, chunks} = renderPage ()
return {html, head, chunks}
}

이 λ¬Έμ œλŠ” nextjs 버전이 2.3-alpha1 일 λ•Œ λ°œμƒν•©λ‹ˆλ‹€.
2.2.0μ—μ„œ 잘 μž‘λ™

λ‚˜λŠ” 이것이 이것과 λ™μΌν•˜λ‹€κ³  κ°€μ •ν•©λ‹ˆλ‹€ : https://github.com/zeit/next.js/issues/2435
항상 μ‚¬μš©μž μ •μ˜ λ¬Έμ„œμ˜ getInitialProps에 λŒ€ν•œ μ˜¬λ°”λ₯Έ ν•­λͺ©μ„ μΆ”κ°€ν•˜μ‹­μ‹œμ˜€. (항상 λ¬Έμ„œ μ°Έμ‘°)

λ˜λŠ” 이것을 μ‚¬μš©ν•˜μ‹­μ‹œμ˜€ :

import Document from `next/document`

static getInitialProps (ctx) {
   return Document.getInitialProps(ctx)
}
이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰