Strapi Admin on Localhost not working after deploying on heroku

I found my mistake.

I had to rebuild the admin panel after any changes to my server.js file by running yarn build or npm run build command.
It fixed the issue after setting up the middleware for CORS correctly.