Browse Source

打包环境配置

e 5 years ago
parent
commit
d57e9d9515
5 changed files with 6 additions and 10 deletions
  1. 0 1
      .env.production
  2. 0 1
      .env.staging
  3. 2 2
      src/main.js
  4. 1 1
      src/utils/request.js
  5. 3 5
      vue.config.js

+ 0 - 1
.env.production

@@ -3,4 +3,3 @@ ENV = 'production'
 
 # base api
 VUE_APP_BASE_API = 'https://mai.caimei365.com'
-

+ 0 - 1
.env.staging

@@ -5,4 +5,3 @@ ENV = 'staging'
 
 # base api
 VUE_APP_BASE_API = 'https://mai-b.caimei365.com'
-

+ 2 - 2
src/main.js

@@ -29,10 +29,10 @@ const simplePwd = '123456' // 简单密码
  * Currently MockJs will be used in the production environment,
  * please remove it before going online! ! !
  */
-import { mockXHR } from '../mock'
+/* import { mockXHR } from '../mock'
 if (process.env.NODE_ENV === 'production') {
   mockXHR()
-}
+} */
 
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium' // set element-ui default size

+ 1 - 1
src/utils/request.js

@@ -6,7 +6,7 @@ import { getToken } from '@/utils/auth'
 // create an axios instance
 const service = axios.create({
   baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
-  // withCredentials: true, // send cookies when cross-domain requests
+  withCredentials: true, // send cookies when cross-domain requests
   timeout: 5000 // request timeout
 })
 

+ 3 - 5
vue.config.js

@@ -24,9 +24,7 @@ module.exports = {
    * In most cases please use '/' !!!
    * Detail: https://cli.vuejs.org/config/#publicpath
    */
-  /* publicPath: process.env.NODE_ENV === 'production'
-    ? '/vue-admin/'
-    : '/', */
+  // publicPath: process.env.NODE_ENV === 'production' ? '/vue-admin/' : '/',
   publicPath: '/',
   outputDir: 'dist',
   assetsDir: 'static',
@@ -38,7 +36,7 @@ module.exports = {
     overlay: {
       warnings: false,
       errors: true
-    },
+    }/* ,
     proxy: {
       // change xxx-api/login => mock/login
       // detail: https://cli.vuejs.org/config/#devserver-proxy
@@ -50,7 +48,7 @@ module.exports = {
         }
       }
     },
-    before: require('./mock/mock-server.js')
+    before: require('./mock/mock-server.js') */
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that