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
I tried to use splitting in my next.js app, but it gives me an error
importReact,{useState,useRef,useEffect}from'react'import'splitting/dist/splitting.css'import'splitting/dist/splitting-cells.css'importSplittingfrom'splitting'exportconstSomePage=()=>{constslideRef=useRef(null)useEffect(()=>{// double checking we actually have a reference (and the value is not null)if(slideRef){slideRef.current.Splitting();}},[slideRef])return(<pref={slideRef}data-splitting='true'>
split some text here
</p>)}
I combined all the answers from previous issues and I managed to get it working in Next.js with the following code:
import"splitting/dist/splitting.css";import"splitting/dist/splitting-cells.css";constComponent=()=>{lettarget;setTimeout(()=>{if(window&&document&&target){constSplitting=require('Splitting');Splitting({by: "chars",target: target,});}});return(<><spanref={(el)=>{target=el;}}>Lorem ipsum dolor sit amet</span></>)}exportdefaultComponent;
Error: Prevent writing to file that only differs in casing or query string from already written file. This will lead to a race-condition and corrupted files on case-insensitive file systems. /.../.next/server/vendor-chunks/Splitting.js /.../.next/server/vendor-chunks/splitting.js at checkSimilarFile (/.../node_modules/next/dist/compiled/webpack/bundle5.js:28:142411) at writeOut (/.../node_modules/next/dist/compiled/webpack/bundle5.js:28:144419) at /.../node_modules/next/dist/compiled/webpack/bundle5.js:28:1369729 at FSReqCallback.oncomplete (node:fs:191:23)
I have this error with the same code as you, this is my package.json: { "name": "x-website", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "gsap": "^3.12.5", "next": "14.1.0", "react": "^18", "react-dom": "^18", "sass": "^1.71.0", "splitting": "^1.0.6" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.1.0", "jarallax": "^2.2.0", "paroller.js": "^1.4.7", "swiper": "^9.4.1", "typescript": "^5" } }
Activity
draZer0 commentedon Aug 19, 2022
I combined all the answers from previous issues and I managed to get it working in Next.js with the following code:
Chandler-Zhu commentedon Aug 19, 2022
if the ref is an arrow function, when exactly does it run? After component mounted ?
diyuksh commentedon Jun 17, 2023
Im having a similar issue cause I'm using it in a hook
Its basically a typeShuffle Effect that uses splitting and spits out the error
brett-sprad commentedon Aug 9, 2023
This worked for me:
...and then you use it like so:
AlexandraKlein commentedon Dec 12, 2023
I am using this:
Baraff24 commentedon Feb 18, 2024
Error: Prevent writing to file that only differs in casing or query string from already written file. This will lead to a race-condition and corrupted files on case-insensitive file systems. /.../.next/server/vendor-chunks/Splitting.js /.../.next/server/vendor-chunks/splitting.js at checkSimilarFile (/.../node_modules/next/dist/compiled/webpack/bundle5.js:28:142411) at writeOut (/.../node_modules/next/dist/compiled/webpack/bundle5.js:28:144419) at /.../node_modules/next/dist/compiled/webpack/bundle5.js:28:1369729 at FSReqCallback.oncomplete (node:fs:191:23)I have this error with the same code as you, this is my package.json:
{ "name": "x-website", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "gsap": "^3.12.5", "next": "14.1.0", "react": "^18", "react-dom": "^18", "sass": "^1.71.0", "splitting": "^1.0.6" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.1.0", "jarallax": "^2.2.0", "paroller.js": "^1.4.7", "swiper": "^9.4.1", "typescript": "^5" } }