SPA Rewrite Inconsistencies

Hi! I’m seeing inconsistencies in how SPA routing is handled between localhost/Netlify Dev and my deployed app.

Specifically, I have a CRA setup with React Router (with the 200 rewrite rule enabled in my netlify.toml), and I have a route that works locally (localhost:3000/swap/0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359), but not in my deploy (https://5d015dc0f6f1d30007612a98– In the deploy, I’m getting the infamous Uncaught SyntaxError: Unexpected token < errors in the console.

The repo is here (

Pretty stumped by this one, would love some help if anyone has any ideas! Happy to provide further clarification.

Hi @noahwz It looks like your referencing js files that don’t exist in the deploy. did you hardcode any of the links to your chunks? or are you caching them?

Hi @futuregerald, I’m definitely not hardcoding links to any chunks, nor should there be any caching. Is it possible that this is an issue with having >1 slash-separated arguments after the root domain? I ask because routing between pages (/swap, /send, etc.) works just fine, and the errors only occur on /swap/* (and even /swap/, actually).

Hi @noahwz,

The error Uncaught SyntaxError: Unexpected token < is almost always caused by something in your site’s code referring to an asset that is no longer available. I do show that you don’t have a serviceworker or some unusual caching going on but you are using hashed filenames. This can cause our system to not ‘see’ a new version since your new version has a different name.

That said, can you try using static filenames and see if that helps?

Please check out this post on Netlify Community: [Common Issue] Why do I see “Uncaught SyntaxError: Unexpected token <” errors? How can I use chunking or versioning for my assets at Netlify?, where you can also ask questions and get more specific information.

Hi @Dennis, thanks so much for your help (and @futuregerald too!). Turns out that this issue was fixed by changing the homepage field in package.json from "." to the production site ""! See this PR for the fix.

Glad you got that fixed up, Noah!