Next.Js Support
See original GitHub issueHi 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:
- Create Next.js App:
npx create-next-app@latest - Install react-spline:
npm install @splinetool/react-spline @splinetool/runtime - 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>
);
}
- 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.
! Even if I don’t use the <Spline> component and just import it on the top, the error appears.
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top 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 >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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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 🙌
@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.