Hi there,

I love Spline and would like to use it in my Next.js app. However, if I follow the instructions of a basic Next.js setup and react-spline setup, I get an error.

Steps to Reproduce:

  1. Create Next.js App: npx create-next-app@latest
  2. Install react-spline: npm install @splinetool/react-spline @splinetool/runtime
  3. Replace content in index.js with:
import Spline from '@splinetool/react-spline';

export default function App() {
  return (
    <div>
      <Spline scene="https://prod.spline.design/6Wq1Q7YGyM-iab9i/scene.splinecode" />
    </div>
  );
}
  1. Run the app: npm run dev

Expected Result: Seeing the default spline animation

Actual Result:

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/silasniewierra/Documents/Coding/test/test-spline/node_modules/@splinetool/react-spline/dist/react-spline.cjs.js:1:546)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
  page: '/'
}
Warning: data for page "/_error" is 430 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
Bildschirmfoto 2022-07-01 um 17 02 32

! Even if I don’t use the <Spline> component and just import it on the top, the error appears.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
SilasNiewierracommented, Jul 4, 2022

@ivanburlakov Finally I was able to fix it. The problem was… my node version was v12 🙈 I changed it to v17 and everything runs smooth like butter.

I figured it out, because I used your repo and tried yarn as well, but I got the exact same error. So I knew it had to be on my system 😄

Thank you so much for your help 🙌

0reactions
ivanburlakovcommented, Jul 3, 2022

@SilasNiewierra I created a working blank project and uploaded it to this repo - https://github.com/ivanburlakov/spline-nextjs-example . Next.js App code structure is a bit different from React.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started | Next.js
System Requirements. Node.js 14.6.0 or newer; MacOS, Windows (including WSL), and Linux are supported. Automatic Setup. We recommend creating a new Next.js ......
Read more >
Supported Browsers and Features - Next.js
js supports modern browsers with zero configuration. Chrome 64+; Edge 79+; Firefox 67+; Opera 51+; Safari 12+. Browserslist.
Read more >
Next.js by Vercel - The React Framework
Next.js gives you the best developer experience with all the features you need for production: hybrid static & server rendering, TypeScript support, ...
Read more >
FAQ - Next.js
Get to know more about Next.js with the frequently asked questions.
Read more >
Basic Features: TypeScript - Next.js
Next.js supports TypeScript by default and has built-in types for pages and the API. You can get started with TypeScript in Next.js here....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found