splinetool / react-spline

React component for Spline scenes.
MIT License
1.16k stars 56 forks source link

[BUG] Can't build on NextJS 14 with typescript and app router #190

Closed Leon-azerty closed 3 months ago

Leon-azerty commented 3 months ago

I tried to build two different projects with spline but I have the same error message each time :

TypeError: Super constructor null of anonymous class is not a constructor
    at new <anonymous> (/.next/server/app/page.js:6312:50455)

...

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: Super constructor null of anonymous class is not a constructor
    at new <anonymous> (/.next/server/app/page.js:6312:50455)

I tried different thing with SSR on, SSR off, Suspense, Lazy loading etc ... but nothing change.

Package.json :

"dependencies": {
    "@gsap/react": "^2.1.0",
    "@hookform/resolvers": "^3.3.4",
    "@radix-ui/react-dropdown-menu": "^2.0.6",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-slot": "^1.0.2",
    "@react-email/button": "^0.0.13",
    "@react-email/components": "^0.0.12",
    "@react-email/html": "^0.0.7",
    "@splinetool/react-spline": "^2.2.6",
    "@splinetool/runtime": "^1.6.8",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.0.0",
    "gsap": "^3.12.5",
    "lucide-react": "^0.323.0",
    "next": "14.1.1",
    "next-themes": "^0.2.1",
    "nodemailer": "^6.9.7",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-email": "^1.10.0",
    "react-hook-form": "^7.49.2",
    "react-icons": "^4.12.0",
    "resend": "^2.1.0",
    "sharp": "^0.33.1",
    "sonner": "^1.3.1",
    "tailwind-merge": "^2.2.1",
    "tailwindcss-animate": "^1.0.7",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@testing-library/jest-dom": "^6.4.5",
    "@testing-library/react": "^16.0.0",
    "@types/node": "^20.8.8",
    "@types/react": "^18.2.31",
    "@types/react-dom": "^18.2.14",
    "autoprefixer": "^10.4.16",
    "eslint": "^8.56.0",
    "eslint-config-next": "14.1.0",
    "jest": "^29.7.0",
    "jest-environment-jsdom": "^29.7.0",
    "postcss": "^8.4.31",
    "prettier": "3.2.5",
    "prettier-plugin-tailwindcss": "^0.5.11",
    "tailwindcss": "^3.3.3",
    "ts-node": "^10.9.2",
    "typescript": "^5.2.2"
  }
meerbex commented 3 months ago

Any updates on this? The same, it is not working only on build

maakle commented 3 months ago

Bumping Next to "next": "14.2.4" solved the issue for me!

marcofugaro commented 3 months ago

Correct, please upgrade to the latest next.js version. Otherwise keep using @splinetool/react-spline v2.2.2.

masoudmanson commented 2 months ago

Bumping Next to "next": "14.2.4" solved the issue for me!

Worked for me too! Thanks 😊