In the vue project, there is a difference between the webpack packaged production environment and the test environment host variable.

Test and production environments in vue projects are often different from each other in front of URL.

is now defined in main.js.
Vue.prototype.host = "http://test.xyz/voronezh";
Vue.prototype.host = "http://dbtest.xyz/voronezh";

these two variables are, of course, more than these two, and the jump paths of some pages are also divided into test and production environments.

location.href = "http://172.20.11.27/Login.aspx?RequestUrl=http:((db.xyz(";
location.href = "http://172.20.11.27/Login.aspx?RequestUrl=http:((dbtest.xyz("

this causes you to switch manually every time you run dev and run build. It"s easy to make mistakes.
you can configure such variables in webpack to use different environments in two cases. Thank you

Nov.02,2021

https://github.com/chenyinkai.

const host = process.env.NODE_ENV === 'development' ? 'dev api host' : 'prod api host' //  process.env.NODE_ENV 

Why use process.env.NODE_ENV this?
because process.env.NODE_ENV is the default global variable in node services, you can freely choose test environment and development environment through it

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45f24-43aee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45f24-43aee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?