fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.72k stars 700 forks source link

NextJs build fails with React-toastify #612

Closed Vivek205 closed 3 years ago

Vivek205 commented 3 years ago

Do you want to request a feature or report a bug? Bug What is the current behavior? Nextjs build fails after adding React-toastify in the project. Cannot read property 'registered' of null at render (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/@emotion/core/dist/emotion-element-0e1e5002.cjs.prod.js:53:84)

What is the expected behavior? Should be able to build the project after adding react-toastify. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Vivek205 commented 3 years ago
Error occurred prerendering page "/pools/add/[...tokens]". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read property 'registered' of null
    at render (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/@emotion/core/dist/emotion-element-0e1e5002.cjs.prod.js:53:84)
    at /Users/vivek/Documents/DAO/dapp-mainnet/node_modules/@emotion/core/dist/emotion-element-0e1e5002.cjs.prod.js:72:9
    at Object.children (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/@emotion/core/dist/emotion-element-0e1e5002.cjs.prod.js:16:14)
    at a.b.render (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:213)
    at a.b.read (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at exports.renderToString (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
    at Object.renderPage (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/next/dist/next-server/server/render.js:54:854)
    at Function.getInitialProps (/Users/vivek/Documents/DAO/dapp-mainnet/.next/server/pages/_document.js:799:19)
    at loadGetInitialProps (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/next/dist/next-server/server/render.js:54:1145)
    at async /Users/vivek/Documents/DAO/dapp-mainnet/node_modules/next/dist/export/worker.js:26:6
    at async Span.traceAsyncFn (/Users/vivek/Documents/DAO/dapp-mainnet/node_modules/next/dist/telemetry/trace/trace.js:6:584)
[==  ] info  - Generating static pages (34/46){ loading: true, data: undefined, error: undefined }
fkhadra commented 3 years ago

Hey @Vivek205, I think your issue is coming from somewhere else. I use the library with Nextjs without any issue. Can you share your setup?

goforbg commented 3 years ago

Same here, I use react-toastify with next.js without any problems!

Vivek205 commented 3 years ago

@fkhadra , Yeah. My bad. The issue was due to the react-loading-skeleton package. I shall close this issue.