i am using react admin in nextjs project i have created all components and in data provider i call the Graphql API (query and mutation) it work fine locally but when i try to make build they through issues i write Yarn buid
yarn build
yarn run v1.22.21
$ next build
▲ Next.js 14.1.0
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
Generating static pages (3/5) [== ]
ReferenceError: document is not defined
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12265
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:14147
at Object.ns [as useMemo] (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:40843)
at t.useMemo (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109391)
at eg (/home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12184)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47419)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61233)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nI (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:46806)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: document is not defined
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12265
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:14147
at Object.ns [as useMemo] (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:40843)
at t.useMemo (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109391)
at eg (/home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12184)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47419)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61233)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
✓ Generating static pages (5/5)
> Export encountered errors on following paths:
/page: /
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
i am try to make build using yarn build but see this issue
yarn build
yarn run v1.22.21
$ next build
▲ Next.js 14.1.0
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
Generating static pages (3/5) [== ]
ReferenceError: document is not defined
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12265
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:14147
at Object.ns [as useMemo] (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:40843)
at t.useMemo (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109391)
at eg (/home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12184)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47419)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61233)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nI (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:46806)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: document is not defined
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12265
at /home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:14147
at Object.ns [as useMemo] (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:40843)
at t.useMemo (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109391)
at eg (/home/eritheia/projects/criclay-dashboard/.next/server/app/page.js:73:12184)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47419)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
at nM (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61233)
at nN (/home/eritheia/projects/criclay-dashboard/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64674)
✓ Generating static pages (5/5)
> Export encountered errors on following paths:
/page: /
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
i want to make build successfully