With Next.js Got error: document is not defined
I am getting error for FormBuilder Component. I saw old issue from octomber 2019 which is closed https://github.com/formio/react-formio/issues/253 which told react-formio@4 will have SSR Support. I am got same error in [email protected] document is not defined
ReferenceError: document is not defined
at Object.<anonymous> (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:869:23)
at Object.8 (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:895:4)
at s (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:621)
at /home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:672
at Object.<anonymous> (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:724:19)
at Object.6../eventmap (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:824:4)
at s (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:621)
at /home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:672
at Object.<anonymous> (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:41:17)
at Object.2../classes (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:647:4)
at s (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:621)
at e (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:792)
at /home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:810
at /home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:88
at Object.<anonymous> (/home/vivekvt/Desktop/codemarket.io/unita/files/node_modules/dragula/dist/dragula.js:1:323)
at Module._compile (internal/modules/cjs/loader.js:1158:30)

- Hosting type
- Local deployment
- Frontend framework: Next.js 9.3.2 [email protected]
- Browser: Google Chrome
- Browser version: 84.0.4147.125
I am closing the issue as it was created too long ago and there is no new comments here. If the issue is not resolved, please reopen it. Thanks!
This is still not resolved. Can we reopen this? I am using Next and getting this error constantly:
Next: 15.1.5 React: 18.3.1
Are you using @formio/[email protected]?
Yes its 6.0.0
@umarq91 did you see https://github.com/formio/react?tab=readme-ov-file#usage-in-nextjs ?