Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 18.6 — Deploying
3D Web · Example 1 of 1

When the server answers a missing model with a web page

Chrome's wording of the JSON error. Other browsers word it differently. Here a missing file really is a 404; the example hands the loader the bytes a SPA fallback would send.

vite build turns the project into plain files. Asset paths, the base setting, caching and compression headers, and MIME types decide whether the models load in production. The classic bug is a missing file that the server answers with a web page.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Give the one-line change that makes MODEL_URL work under any base.

02

Write the curl command and the two headers you would check for the Draco decoder.

Explain it without notes

01

The deployed showroom shows "The bike could not be loaded" but works locally. Give three likely causes and how you would tell them apart.

02

Which files get long caching and which must not, and why?

When the server answers a missing model with a web page
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

index.html instead of the .glb -> Unexpected token '<', "<!doctype "... is not valid JSON
an empty answer                -> Invalid typed array length: 4
the real file starts with: glTF | the wrong answer starts with: <!do
missing file here: 404