Don't! Exposing server stuff on the client is madness. Create an env.js file and import that when you need it.
Mar 23, 2017
2
Level 5
Environment variables for Vue application
Hi,
I am deploying SPA Vue.js 2.0 application trough Laravel forge to Digital Ocean. I am figuraing out how to set tup environment variables so that browse can read them trough JS.
I have this line in my config.js that is part of Vue application:
var env = process.env.APP_ENV || 'development'
I have tried to edit Environment file in Forge and added APP_ENV=production but it does not work.
How do I setup up my environment variables for JS to read them?
Please or to participate in this conversation.