add laravel env variable to vue component

Solutions on MaxInterview for add laravel env variable to vue component by the best coders in the world

showing results for - "add laravel env variable to vue component"
Alessandro
17 Oct 2016
1in windows :
2
3thats worked for me without any require in webpack.mix
4
5... just add a new variable in env file with this prefix : MIX_
6
7MIX_API_URL=http://laravel:8000
8but need to restart php artisan serve and also restart npm run watch....
9
10  let api_url = process.env.MIX_API_URL;
11  console.log("my env variable:");
12  console.log(api_url);