Simple react project broken on netlify

Hello, I have a simple react project which I uploaded to Netlify - https://kilo-map.netlify.app/

The problem is that current floor component breaks when uploaded on Netlify, but it works ideally locally and hosted in github pages, so it’s clear that it is Netlify problem and not the code. Is there a way that it can be fixed?

Hi @Dovtutis,

Thanks for reaching out and welcome to Netlify’s Support Forums!

Could you provide us steps to reproduce the issue? What should we see when visiting the site and what part exactly is broken?

This is what I see when visiting the site:


@Melvin thank you for response

That component in the bottom right, which shows current floor is broken.

I recorded how it works locally and on github pages.

@Dovtutis Everything that you’re displaying is front-end code and so it’s unlikely to be a Netlify specific issue.

It’s more likely that there is some difference between what you’re building/deploying on Netlify, and what is built/deployed elsewhere.

Are you building on Netlify, or only deploying the files there?

Are all locations building from the same repository, from the same branch, with the same files and much the same configuration etc?

Are you able to supply a link to the repository?

I have built locally with npm run build command in my code editor and then uploaded folder to Netlify.

The code is identical everywhere, I tried to rebuild, reupload, nothing helped.

You can find the code here: GitHub - DovydasTutinas/kilo-map

Thank you for your help!

Edit: I have tried to upload directly from github and build in Netlify, same result: https://golden-lamington-e72287.netlify.app/

@Dovtutis When I run your project with npm run start locally I do not see the issue.

However I see precisely the same error locally when I run your build via npm run build, and then use npx serve -s build.

You could also install serve as the React build command suggests:

image

Serving your build output with a static server locally is a great way of simulating it being hosted on Netlify.

So the error isn’t Netlify specific, it has to do with the output of your build command.

You should check what the build performs that the development server does not, for example build optimization that may be adversely impacting your code.

So is there a way to change build settings? To disable or enable something? Never had such a problem or anything similar, so I event don’t know where to start :slight_smile:

I can’t advise, as I don’t work with React myself.

All I know is that it’s easy to prove that it happens when you run the build and not when you run the serve and that it’s not caused by Netlify.

It’s related to the code/configuration of your project, either yours, react’s or some dependency.

You should continue to debug your project and if nobody else here can chime in, you should seek assistance from a more React-centric community elsewhere.