I am trying to work out how to call the variables that live in the .env file from inside of a Vue file in a laravel project.
Surely there is an easy way to do this I am overlooking...
Using the follow doesn't''t work but I didn't expect it would.
first of all, you should never use any environment variable in your files. If you need to, pass the environment into the config.php file, and call the config, dont call .env file directly.
as for have to use config value in frontend, there are some package to handle that, but it is dependent on your stack
@camkem You absolutely don’t want to be accessing environment variables from JavaScript. Your environment variables contain sensitive information like database credentials, API keys and secrets, etc. If you’re pulling them into JavaScript then any one will be able to read them!