Skip to content
afterbuild.dev
$ curl -sI https://yourapp.com/assets/index-abc123.js | head -1

The console says Unexpected token '<' and the code looks fine

The code really is fine. The error is about what arrived, not about what you wrote.

We have not measured how often this specific error appears. Everything below is mechanics you can confirm with one request.

What is actually happening

`<` is the first character of `<!doctype html>`. The browser asked for a JavaScript file, was given a web page, and reported the first character it could not parse as JavaScript.

The usual cause is a catch-all rewrite: a rule that answers every unmatched address with `index.html` will also answer a missing script that way, instead of returning a plain 404.

So this error and the 404-on-refresh problem are frequently the same misconfiguration, fixed at one end and overdone at the other.

Confirm it in one command

SHELL
curl -sI https://yourapp.com/assets/index-abc123.js | head -1

200 with content-type text/html is the diagnosis: a JavaScript URL is being answered with a web page.

Fixing it yourself

Where it stops being a small job

When the file is genuinely missing rather than mis-served — then the question moves to why the build produced a different filename than the HTML is asking for, and that is a build problem rather than a serving one.

If the script is genuinely missing rather than mis-served, the trail leads back into the build and gets longer. Send the address and we will follow it.

Send us the app