1

In package.json I have the homepage set to be "/subfolder"
That should be true only for the production build. When I develop I would like it to be: localhost:3000, or so I hoped
It seems when I add homepage value it also take effect when I do npm start not just npm run build . Is there any way to force this only on none dev builds?

create-react-app -V
3.4.1  
Itay Moav -Malimovka
  • 50,983
  • 60
  • 187
  • 270

1 Answers1

0

You can use this inside your code and make difference between production with the other environments in runtime:

export const production = window.location.href === 'https://your_production_url/';

Be aware of http or https.