Closed AlexanderZeilmann closed 1 month ago
@AlexanderZeilmann thanks for the bug report. It should be fixed in version 6.2.10 now
Thank you @bbohlender! Yes, the bug is fixed! However, the nextjs build process is not yet completing successfully.
With the same setup as above I get the error
./src/app/page.tsx:22:32
Type error: Type '{ color: string; }' is not assignable to type 'ExtendedColors<Overwrite<Partial<{}>, NodeProps<{}, {}>>>'.
Property 'color' does not exist on type 'ExtendedColors<Overwrite<Partial<{}>, NodeProps<{}, {}>>>'.
20 | >
21 | <boxGeometry />
> 22 | <meshBasicMaterial color={red ? "red" : "blue"} />
| ^
23 | </mesh>
24 | </XR>
25 | </Canvas>
Removing the color
attribute, results in yet another error:
npm run build
> nextjs-blog@0.1.0 build
> next build
▲ Next.js 14.2.13
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
Generating static pages (0/5) [= ]ReferenceError: navigator is not defined
at /Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:38630
at /Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:38746
at 4737 (/Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:41745)
at Object.t [as require] (/Users/bug_reports/xr_next/nextjs-blog/.next/server/webpack-runtime.js:1:127)
at require (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:18228)
at i (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:88294)
at /Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:98817
at /Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:98904
at t (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:99107) {
digest: '201334988'
}
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: navigator is not defined
at /Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:38630
at /Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:38746
at 4737 (/Users/bug_reports/xr_next/nextjs-blog/.next/server/app/page.js:352:41745)
at Object.t [as require] (/Users/bug_reports/xr_next/nextjs-blog/.next/server/webpack-runtime.js:1:127)
at require (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:18228)
at i (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:88294)
at /Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:98817
at /Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:98904
at t (/Users/bug_reports/xr_next/nextjs-blog/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:99107)
✓ Generating static pages (5/5)
> Export encountered errors on following paths:
/page: /
@AlexanderZeilmann
the error regarding the color is unrelated to react-three/xr and most likely related to your typescript version.
The navigator error should be fixed now :)
@bbohlender I'm actually experiencing the same issue with the color prop
Type error: Type '{ color: string; }' is not assignable to type 'ExtendedColors<Overwrite<Partial<{}>, NodeProps<{}, {}>>>'. Property 'color' does not exist on type 'ExtendedColors<Overwrite<Partial<{}>, NodeProps<{}, {}>>>'.
When you say the TS version error, can you elaborate on that?
Thanks!
Edit: I'm using TS v5
The next js build step is not working with the current version of
xr
.Steps to reproduce
Create a new next js app
confirm all questions with the default settings. Run
to confirm that next js is working.
Install
npm install three @react-three/fiber @react-three/xr@latest
Modify the
page.tsx
file such that it looks like this (I just removed the default HTML and added the xr example from the readme):Running
npm run build
fails with the following errorAdditional Observation
Removing all
xr
code (but leaving the fiber code) fixes the error.