Comments (4)
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.
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.
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.
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)
- WebGLRenderTarget Texture breaks glTF export HOT 2
- games_fps Example: Collision detection anomaly HOT 4
- Bug Collision detection anomaly HOT 1
- Why functions like Box3.getSize() need a vector3 parameter ? HOT 2
- 161 -> 162 DragControls breaks for multiple groups HOT 1
- USDZLoader: loading a binary file does not throw error
- packDepthToRG seems broken HOT 12
- USDZLoader doesn't support all .usdz(usda) files. The only showcase example file works. HOT 3
- games_fps Example clash detection anomaly
- Shader unit test framework
- Regression introduced in r144, re: WebXRManager.updateCamera HOT 1
- TSL: Wrong compilation of `min(...)` and `max(...)` with 3 or more parameters
- Should a function be added to distinguish between WebGPU and WebGL in order to run different code? HOT 5
- Three.js doesn't support SVG with url HOT 1
- WebGPU+Light+NormalMaterial throws an error
- PassNode: Implement Auto-MRT. HOT 5
- Different default background colors of WebGLRenderer and WebGPURenderer HOT 3
- Allow to Use Roughness for SSR in Three.js
- WebGPURenderer: Make output of post-processing passes configurable. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.js.