0
정의되지 않은 구성 요소 require.default 반응 다른 텍스트를 사용하면 HMR에서 페이지를 다시로드하는 중에 오류가 발생합니다.나는 다음과 같은 구성 요소를 구축했습니다
[HMR] connected
client.js?6a8d:199 [HMR] bundle rebuilding
client.js?6a8d:207 [HMR] bundle rebuilt in 557ms
process-update.js:27 [HMR] Checking for updates on the server...
client.js:24 =====================================
client.js:25 undefined
warning.js:36 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
printWarning @ warning.js:36
warning @ warning.js:60
createElement @ ReactElementValidator.js:171
patchedCreateElement @ patch.dev.js:164
render @ client.js:11
(anonymous) @ client.js:26
hotApply @ bootstrap a9a1805…:566
cb @ process-update.js:52
(anonymous) @ process-update.js:68
process-update.js:115 [HMR] Cannot check for update (Full reload needed)
handleError @ process-update.js:115
applyCallback @ process-update.js:45
process-update.js:116 [HMR] Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
at invariant (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:946:15)
at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:11215:55)
at ReactCompositeComponentWrapper._updateRenderedComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19850:24)
at ReactCompositeComponentWrapper._performComponentUpdate (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19813:10)
at ReactCompositeComponentWrapper.updateComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19734:12)
at ReactCompositeComponentWrapper.receiveComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19636:10)
at Object.receiveComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:3479:22)
at ReactCompositeComponentWrapper._updateRenderedComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19843:23)
at ReactCompositeComponentWrapper._performComponentUpdate (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19813:10)
at ReactCompositeComponentWrapper.updateComponent (http://localhost:3001/dist/main-a9a1805da1160c9fe908.js:19734:12)
콘솔 로그에서 NextApp
은 undefined
을 리턴하므로 render(NextApp)
이 실패합니다.
const NextApp = require('...').default
이 undefined
인 이유는 무엇입니까? 그 문제를 해결하는 방법?
도와 주셔서 감사합니다.
무슨 힌트 ... 예, Webpack 2를 사용 중이며 2 일 동안 로밍이 끝난 후 문제가 해결되었습니다 .... 감사합니다! – Mendes
☺ 기꺼이 도움이되었습니다. – hazardous