You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to serve a Remix+NextUI application to Netlify (either functions or to the edge), receive a ReferenceError: document is not defined when serving the application
Taking NextUI components out of the application and the error does not occur.
Add NextUIProvider wrapper around the app in ./app/root.tsx
Run npm build && netlify serve to validate that solution still executes as expected.
Add any NextUI component to the ./app/routes/_index.tsx component
Example: replace the first <a>nchor tag with a <Link> component
-or- add a <Button>Clickable</Button> component
-or- add a <Snippet>snippet</Snippet> component
Run npm build && netlify serve and observe the following error:
◈ Loaded edge function remix-server
[remix-server] ReferenceError: document is not defined
at $431fbd86ca7dc216$export$b204af158042fbac (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:14439:155)
at $431fbd86ca7dc216$export$f21a1ffae260145a (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:14443:15)
at $507fabe10e71c6fb$var$setupGlobalFocusEvents (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:15512:86)
at $507fabe10e71c6fb$export$ec71b4b83ac08ec3 (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:15605:3)
at $f7dceffc5ad7768b$export$4e328f61c538687f (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:15716:3)
at useLink (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:18728:53)
at file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:18762:7
at Wc (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:13602:13)
at Zc (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:13727:13)
at Z$1 (file:///home/drovani/remix-nextui-netlify-edge/build/server/assets/server-build-CTJ-Eq0G.js:13784:9)
Reset the <a>nchor tag back to the HTML element and rerun npm build && netlify serve; all is well.
Expected behavior
As a website builder, I would expect that NextUI would work in a functions environment seamlessly along with the Remix application.
Screenshots or Videos
No response
Operating System Version
OS: WSL; though this is specific to Netlify
Browser
Chrome
The text was updated successfully, but these errors were encountered:
NextUI Version
2.4.8
Describe the bug
When attempting to serve a Remix+NextUI application to Netlify (either functions or to the edge), receive a
ReferenceError: document is not defined
when serving the applicationTaking NextUI components out of the application and the error does not occur.
Your Example Website or App
https://github.com/drovani/remix-nextui-netlify-edge
Steps to Reproduce the Bug or Issue
npx create-remix@latest --template netlify/remix-template
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init --ts -p
./tailwind.config.ts
./app/tailwind.css
LinksFunction
export to./app/root.tsx
npm build && netlify serve
to validate that solution executes as expected.npm i @nextui-org/react framer-motion
./tailwind.config.ts
with NextUI pluginNextUIProvider
wrapper around the app in./app/root.tsx
npm build && netlify serve
to validate that solution still executes as expected../app/routes/_index.tsx
component<a>
nchor tag with a<Link>
component<Button>Clickable</Button>
component<Snippet>snippet</Snippet>
componentnpm build && netlify serve
and observe the following error:<a>
nchor tag back to the HTML element and rerunnpm build && netlify serve
; all is well.Expected behavior
As a website builder, I would expect that NextUI would work in a functions environment seamlessly along with the Remix application.
Screenshots or Videos
No response
Operating System Version
Browser
Chrome
The text was updated successfully, but these errors were encountered: