[Vuejs]-How to check whether a browser app is running on local dev server vs. online staging server?

1👍

I don’t know much about your project, but process.env.NODE_ENV is a server side environment variable, and Vue is a client side application, so it will not have access to that.

You would have to pass that environment variable to your client somehow. If you are using webpack, you could use the DefinePlugin feature:

https://webpack.js.org/plugins/define-plugin/

This will allow you to define a global variable which you could then access inside of Vue.

Leave a comment