4

Is there possibility to override publicPath in react-scripts for dev env. I use symfony and I include react app inside twig so I had to change assets to serve from http://localhost:3000/static/js/bundle.js - this works fine but I have problem with static files because they are rendered in browser as '/static/media/logo.813ua.png' and my current url is http://localhost:8000

What I did is I run yarn eject and modify in webpack.config.dev.js: var publicPath = 'http://localhost:3000/' and everything is working fine but I don't want to eject so is there any possibility to do this without ejecting react-scripts ?

Thomas
  • 503
  • 1
  • 12
  • 18

1 Answers1

0

Specify your port with with process.env.PORT (package.json)

"scripts": {
  "start": "PORT=1234 react-scripts start"
}
ravibagul91
  • 20,072
  • 5
  • 36
  • 59