当前位置:网站首页>Multiple environment variables
Multiple environment variables
2022-06-25 10:53:00 【Stranger & love sorrow】
The output process of a project
1 Customers have needs , And looking for companies to make
2 Company receipt , And submit it to the product manager to make a prototype
3 After the prototype drawing is made , Confirm with the customer
4 To hand over to ui Conduct project design
5 Design complete , The front and rear ends start working , Making pages and background data
6 As the front end , If there is no background data at the beginning , have access to json Perform background data simulation
7 Last , The front and rear ends shall be debugged together , Of course , When there is data at the beginning , The front end needs to be debugged when it is working
8 Project completion , To be tested , Change bug
9 Go online after passing the test , A project is completed
What are the environment variables
development environment development Use npm run serve start-up
Test environment test Use npm run test start-up
Online environment production Use npm run build package
Why configure environment variables
Easy to modify , No need to restart the project , No need to change the code
Requirements for environment variable configuration
With VUE_APP_ start , Can pass process.env.VUE_APP_ visit .
such as ,VUE_APP_ENV = 'development' adopt process.env.VUE_APP_ENV visit .
except VUE_APP_* Beyond variables , There are two special variables NODE_ENV and BASE_URL
How to configure multiple environment variables
1 stay package.json Medium scripts Set multiple environment variables in
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test":"vue-cli-service --mode test"
},
2 newly build .env.development File write development environment settings
NODE_ENV = "development"
VUE_APP_BASE_URL = " Public code snippet of the request URL of the development environment "
newly build .env.test File write test environment settings
VUE_APP_BASE_URL = " Request code snippet for the test environment "
newly build .env.production File write online environment settings
VUE_APP_BASE_URL = " Request code snippet for the online environment "
3 Revised to axios Request configuration request common code
const server = axios.create({
baseURL:process.env.VUE_APP_BASE_URL,
timeout: 6000
})
matters needing attention :
1 All words are fixed properties , Do not modify
2 After configuration, you need to restart the project
边栏推荐
- 单片机开发---基于ESP32-CAM的人脸识别应用
- keep-alive
- Requirements and precautions for applying for multi domain SSL certificate
- Five types of questions about network planning
- 学会自学【学会学习本身,比学什么都重要】
- Task03 probability theory
- Detailed explanation of Android interview notes handler
- Es learning
- Performance memory
- This is enough for request & response
猜你喜欢
Your driver settings have been set to force 4x antialiasing in OpenGL applications
Oracle彻底卸载的完整步骤
Request&Response有这一篇就够了
This is enough for request & response
【文件包含漏洞-04】经典面试题:已知某网站仅存在本地文件包含漏洞时,如何GetShell?
Binder explanation of Android interview notes
Mqtt beginner level chapter
西门子PLCS7-200使用(一)---开发环境和组态软件入门
1-7snapshots and clones in VMWare
The path of Architects
随机推荐
[today in history] June 24: Netease was established; The first consumer electronics exhibition was held; The first webcast in the world
[RPC] i/o model - Rector mode of bio, NiO, AIO and NiO
一文了解Prometheus
Unreal Engine graphics and text notes: use VAT (vertex animation texture) to make Houdini end on Houdini special effect (ue4/ue5)
Is it safe to open a stock account on the compass?
Comparison and evaluation of digicert and globalsign single domain ov SSL certificates
[paper reading | deep reading] drne:deep recursive network embedding with regular equivalence
单片机开发---基于ESP32-CAM的人脸识别应用
Dell technology performs the "fast" formula and plays ci/cd
持续交付-Jenkinsfile 语法
Software testing to avoid being dismissed during the probation period
Network protocol learning -- lldp protocol learning
XSS攻击
[paper reading | depth] role based network embedding via structural features reconstruction with degree regulated
单片机进阶---PCB开发之照葫芦画瓢(二)
Houdini图文笔记:Your driver settings have been set to force 4x Antialiasing in OpenGL applications问题的解决
Learn to learn self-study [learning to learn itself is more important than learning anything]
Bitmap is converted into drawable and displayed on the screen
我希望按照我的思路尽可能将canvas基础讲明白
WPF binding expression and binding data source (I)