Giter Site home page Giter Site logo

Comments (4)

gkjohnson avatar gkjohnson commented on June 28, 2024 1

Unexpected token '<', "<!doctype "... is not valid JSON

If you're getting this error then it means your server is providing some kind of default HTML for the request and likely not returning an error code the way it should.

from three.js.

Mugen87 avatar Mugen87 commented on June 28, 2024 1

TBH, I don't think throwing an error with the message Something went wrong upon loading model '${filePath}'. Does it exist? is not an improvement. An error might occur for multiple reasons and listing possible root causes is not necessarily helpful and can confuse devs. To me, the existing error is actually accurate since it clearly shows that something with the response isn't right (it is not JSON). The reason for an invalid response that can be manifold, it does not has to be a wrong path.

from three.js.

donmccurdy avatar donmccurdy commented on June 28, 2024 1

I can't seem to find anything in Vite's configuration to have it return an HTTP 404 for a missing file like /not-a-real-folder/scene.glb, it always seems to return index.html (if it exists) with an HTTP 200. That's unfortunate, and would be good feedback for Vite in my opinion. That said, I do think Vite is still the best tool to recommend in the introduction.

Another option is to put models in the src/ folder and let Vite handle resolving the source path and moving it to the build folder. This also allows using Vite plugins to optimize the 3D files. But this approach is more specialized to Vite, and may not work in other bundlers, so I'm not sure we should advise it in the introduction at this time.

from three.js.

pedzed avatar pedzed commented on June 28, 2024

I am using Vite and running my dev server through npm run dev, nothing out of the ordinary.

Since Vite is suggested in the docs, I think it's a good to make sure that error messages are not as vague as this.

from three.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.