Get the App
SLTechnology News&Howtos  ›  Development  › 

How to develop vue cli3 configuration and test the environment

Shulou Source: shulou.com Published: 2022-06-03 05:59:00 10月21日 Update

Today, I will talk to you about how to carry out vue cli3 configuration development and testing environment, many people may not know much, in order to let everyone know more, Xiaobian summarized the following content for everyone, I hope you can harvest according to this article.

CLI3 Create vue project is a simplified version of the build and config files, so configure the development environment, test environment, production environment, then you need to create your own env file.

vue-cli3 Configure development environment, test environment, online environment

Add to package.json file

"scripts":{

"serve":"vue-cli-serviceserve",//invoke development api

"build":"vue-cli-servicebuild",//online

"test":"vue-cli-servicebuild--modetest",//content to be added, test

},

Create an.env file in the root directory and configure

NODE_ENV='production'

VUE_APP_FLAG='pro'//vue code can be used directly with VUE_APP_name

Create an.env.test file in the root directory

NODE_ENV='production'

VUE_APP_FLAG='test'

outputDir=test//You can change the directory name output when packaging, the default is dist

Create vue.config.js in the root directory

vue-cli3 copy code

module.express={

baseUrl:process.env.NODE_ENV==='production'? '/static/':'./ ',

devServe:{

port:8080,

//disableHostCheck:true,//handle host not recognized problem

},

baseUrl:'/',//Basic path, do not change it at will

outputDir:process.env.outputDir,//package generation directory

assetDir:'static',

lintOnSave:false,

runtimeCompiler:true,//whether to use Vue build with runtime compiler

productionSourceMap:false,//sourcemap of production environment

}

After reading the above, do you have any further understanding of how to configure vue cli3 development and test environment? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.

Tags: Environment development testing configuration files content root directory code name directory production more version knowledge article compiler industry information channel path Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker NVidia Shulou Information Microsoft