Are you using mix to compile now instead of create react app?
If so, try prefixing the variable in both env file and scripts with MIX_. Eg MIX_REACT_APP_URL
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
The react project was originally developed separately using create react-app but have been successfully merged in to the laravel app most of the pages load fine except for images that makes use of the process.env.REACT_APP_URL a log of process.env results in an empty object {} showing that the method is working but it is not picking up the react env variables.
I have checked against the common causes of this issue which are
.env file is located at the root of the laravel project along with package.json and composer.json etcpackage.json
npm run dev when ever i make a change if am not running npm run watch
What could i be missing?
Are you using mix to compile now instead of create react app?
If so, try prefixing the variable in both env file and scripts with MIX_. Eg MIX_REACT_APP_URL
Please or to participate in this conversation.