When I run my Vue app, the console shows:
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See mo
I usually use:
if(window.location.href.indexOf("localhost") >= 0) {
// Development mode
}
Or:
if(window.location.href.indexOf("localhost") < 0) {
// Production mode
}
By just searching for part of the development URL like localhost
you don't need to be so specific with the rest of the address. This works anywhere in your project, unlike process.env.NODE_ENV
which won't work in the index.html
file for example.