React component fails to load on deployed site but works locally

@krd81 What you’re looking for, is if it works or not.

Vite doesn’t do exactly the same thing when running its development server as it does when it produces a production build.

This frequently leads to people saying “my project works locally but doesn’t work when deployed”.

But the issue isn’t the deployment, or Netlify, it’s that the build is quite literally different.

Often the first time people notice is when they’re deploying to Netlify, because it’s the first time they view the output of the build.

Running npm run build && npm run preview performs your actual build, producing it to the dist folder, and then serves it so you can view it.

1 Like