Vercel website don't show the loaded model from Vite public folder

The problem begins when I deploy the website. The website go live but when I get on the scene of the model I receive:

SyntaxError: Unexpected token ‘v’, “version ht”… is not valid JSON
at JSON.parse ()
at sM.parse (index-DLKXDEuM.js:3841:113086)
at Object.onLoad (index-DLKXDEuM.js:3841:112230)
at index-DLKXDEuM.js:3841:87116

I made the config:

import { defineConfig } from 'vite';

export default defineConfig({
  assetsInclude: ["**/*.glb"],
});

I have some projects on vercel using vite, but It’s the first time I created my own model.

Can you help me figure out what I made wrong?

if you look at the network tab, does it show that the request to the glb model succeeds? if not, what does it return?

I think you can also test this locally by running vite build and then locally hosting/inspecting the build file? to see if the glb file is correctly copied?

basically, the core issue is that you want the glb files to be hosted statically, so you need to be able to open a URL in your web app that has the glb file and for it to load/download

see also same issue here (although it looks like you already have the assetsInclude part set, so not sure why it’s not working. If you’re able to post your project on github or share a link to it or something I can take a deeper look

1 Like

Thank you for answering, @Omar_Shehata!
As you suggested, I made some analysis on network tab and the scene was fetched:


I made tests with gltf and glb and received the same result.

I uploaded the project on github:

and I deployed on Vercel:
https://nacffo-office-room.vercel.app/

Oh god, now I think I know why:

1 Like

yes you can see that in your network tab! You can’t actually download the gltf file from the served website and put it in blender (you can open it as a text file and see that it does not contain the contents)

1 Like

an easier way to see it is directly on github, you can see it is stored with git lfs:

1 Like