Thomas
Thomas

Reputation: 545

React - react-scripts publicPath

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 ?

Upvotes: 4

Views: 861

Answers (1)

Yauheni Nikanovich
Yauheni Nikanovich

Reputation: 1

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

"scripts": {
  "start": "PORT=1234 react-scripts start"
}

Upvotes: 0

Related Questions