Vue project scientific method example example

When we develop projects, use the Vue-CLI 2.x version, only DEV, PRO development environment, sometimes need a TEST environment to use it, so I have found a lot of ways, summed up a maximum. Simple method to use

1, package.json

Add a Test run command below Build

  "Test": "Node Build / Build.js"  

Vue 项目分环境打包的方法示例 2, Prod.Env.js

In Config -> Prod.Env.js modified code

‘Use strict’ // read system operation Variable const target = process.env.npm_lifecycle_event; // Console log Output console.log (‘Env is deploying, current env is’, target) // Judging environment variable, is TEST, or buildiff (target ==’ test ‘) {var obj = {node_env:’ “Production” ‘, API_ROOT:’ “Replacing this site with test environment address” ‘,}} else {var obj = {node_env:’ “product”, API_ROOT: ‘” Displacement to test environment address “‘,}} module.exports = obj;

   3. Test environment: 

Formal environment:
   
“ $ NPM Run Build“`


The above is all of this article, I hope to help everyone, I hope everyone will support Tumi cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment