Reputation: 3464
I'm using thevue-cli 2.8.1
with a full-featured webpack template. I have a component that needs access to the environment variable in order to display different content for either dev
or prod
environments. How would you get access to this variable?
Upvotes: 1
Views: 57
Reputation: 3464
It's much easier than I thought.
One can access the env variable from anywhere in the app code.
console.log(process.env.NODE_ENV) //production || development
Upvotes: 1