Add Laravel .env Variable To Vue Component

[Solved] Add Laravel .env Variable To Vue Component | Php Frameworks Laravel - Code Explorer | yomemimo.com
Question : Add Laravel .env variable to Vue component

Answered by : excited-elephant-6ik1f7e4upsm

in windows :
thats worked for me without any require in webpack.mix
... just add a new variable in env file with this prefix : MIX_
MIX_API_URL=http://laravel:8000
but need to restart php artisan serve and also restart npm run watch.... let api_url = process.env.MIX_API_URL; console.log("my env variable:"); console.log(api_url);

Source : | Last Update : Thu, 24 Jun 21

Answers related to Add Laravel .env variable to Vue component

Code Explorer Popular Question For Php Frameworks Laravel