pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.7k stars 309 forks source link

Add parseRaw to output parsed component tree jsx string without passing though prettier #256

Open jo-chemla opened 5 months ago

jo-chemla commented 5 months ago

I stumbled upon the below error setting up a React project with Vite and trying to use the gltfjsx parser standalone.

npm create vite@latest my-app --template react

The error raised is the following: Cannot read properties of undefined (reading 'languages') and it occurs during the return of the parse function at return prettier.format(output, {...

image

This PR aims as a workaround to add another exported parser function, parseRaw which outputs the raw string. The original parse function gets output from parseRaw and return the prettier result on top of it as before.