0

Why my heroku app is serving app directory? This directory and it's files should not appear like you see in the picture. Should display only static directory. I use rimraf npm package to remove sourcemaps (.map files) and when I use serve -s build command it works properly on localhost, it displays only the static directory. But when I deploy my files to heroku using heroku/nodejs buildpack it serves the files like in the picture. Important to note: I use just create react app and don't use any http server like express.js

@edit Ok I know where is the problem. On localhost I use serve -s build and it serves just build directory. When I use npm start on localhost it serves app and build like on the heroku. Because I use npm start on heroku. But how to switch this command to serve? Tried to replace the start script with "start": "serve -s build" but it works only on localhost.

google tools show source code

Marcinek
  • 47
  • 4

1 Answers1

0

Ok I solved this problem. Right now I use npm start script which call nodemon ./server.js script which is just express server with get '/*' and send a index.html No more serve or react-scripts start on production.

Marcinek
  • 47
  • 4