Home
Support Forums

Uncaught SyntaxError: Unexpected token '<' and ChunkLoadError: Loading chunk 16 failed

So i have a react app (set up using create-react-app) but any time I push to Netlify and there is a new build, I get these errors

Uncaught SyntaxError: Unexpected token ‘<’ 16.0fcd6807.chunk.js:1

And directly under this is this error

ChunkLoadError: Loading chunk 16 failed. react_devtools_backend.js:2560 ChunkLoadError: Loading chunk 16 (missing: http://localhost:3000/static/js/16.0fcd6807.chunk.js)

I have try all solutions possible online like setting homepage to “homepage” : “.” in package.json, setting base in index.html with , and other solutions on SO and online as a whole. I am currently on react version 17.0.2 and react-scripts 4.0.3.

Everything I have tried seems to still not fix this issue. What could be the problem and How could I solve this. Thanks

Welcome to the Forums @codebarz

Do you have repo you could share so that others might test?

Thank you for your prompt response. Unfortunately, this is a private project and source code can not be shared.

I think you’re somehow publishing a development build. Reasons for me to think that:

and

These indicate a development environment.

The localhost is a placeholder for the domain. But for the devtools are you saying are should set NODE_ENV on netlify to production?

You mean, you replaced your domain name with localhost while posting? if yes, did you also add :3000 yourself?

I’m not sure. I just assumed a Devtools script should probably not exist in a production build. So, it might be a development build. But yes, your NODE_ENV should always be set to production while building on Netlify.

Yes, I added 3000 myself