shenjunjie 7 years ago
parent
commit
03e84e0035
4 changed files with 20 additions and 37 deletions
  1. 1 10
      .babelrc
  2. 13 13
      nuxt.config.js
  3. 2 10
      package.json
  4. 4 4
      plugins/city-service.js

+ 1 - 10
.babelrc

@@ -1,14 +1,5 @@
 {
   "presets": [
-    "es2015",
-    "stage-2"
-  ],
-  "plugins": [
-    ["transform-runtime", {
-      "helpers": false, // defaults to true
-      "polyfill": false, // defaults to true
-      "regenerator": false, // defaults to true
-      "moduleName": "babel-runtime" // defaults to "babel-runtime"
-    }]
+    "@nuxt/babel-preset-app"
   ]
 }

+ 13 - 13
nuxt.config.js

@@ -68,19 +68,19 @@ module.exports = {
       'vuerify',
       'vee-validate'
     ],
-    babel: {
-      presets: ['es2015', 'stage-2'],
-      plugins: [
-        'transform-async-to-generator',
-        'transform-runtime'
-      ],
-      comments: true
-    },
-    postcss: [
-      require('autoprefixer')({
-        browsers: ['last 3 versions']
-      })
-    ]
+    // babel: {
+    //   presets: ['es2015', 'stage-2'],
+    //   plugins: [
+    //     'transform-async-to-generator',
+    //     'transform-runtime'
+    //   ],
+    //   comments: true
+    // },
+    // postcss: [
+    //   require('autoprefixer')({
+    //     browsers: ['last 3 versions']
+    //   })
+    // ]
   },
   css: [
     {src: '~assets/scss/mobileCommon.scss', lang: 'scss'},

+ 2 - 10
package.json

@@ -39,20 +39,12 @@
     "precommit": "npm run lint"
   },
   "devDependencies": {
-    "babel-plugin-component": "^0.10.1",
-    "babel-plugin-external-helpers": "^6.22.0",
-    "babel-cli": "^6.24.1",
-    "babel-core": "^6.26.0",
+    "@nuxt/babel-preset-app": "^2.3.4",
     "babel-eslint": "^7.1.1",
-    "babel-loader": "^7.1.1",
-    "babel-plugin-transform-runtime": "^6.23.0",
-    "babel-preset-es2015": "^6.24.1",
-    "babel-preset-stage-2": "^6.24.1",
-    "css-loader": "^0.28.7",
     "eslint": "^4.13.0",
-    "eslint-plugin-flowtype": "^2.49.3",
     "eslint-config-standard": "^6.2.1",
     "eslint-loader": "^1.6.1",
+    "eslint-plugin-flowtype": "^2.49.3",
     "eslint-plugin-html": "^2.0.0",
     "eslint-plugin-promise": "^3.4.1",
     "eslint-plugin-standard": "^2.0.1",

+ 4 - 4
plugins/city-service.js

@@ -1,5 +1,5 @@
 import axios from 'axios'
-import store from '~store'
+// import store from '~store'
 
 const service = axios.create({
   withCredentials: true,
@@ -10,8 +10,8 @@ service.interceptors.request.use(config => {
   // is server render, use ${baseUrl} directly rather than ${proxyUrl}
   if (typeof window === 'undefined') {
     config.url = process.env.baseUrl + '/city/' + process.env.cityDomain + config.url
-    config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
-    config.headers['User-Agent'] = store.state.option.userAgent
+    // config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
+    // config.headers['User-Agent'] = store.state.option.userAgent
   } else {
     config.url = '/city/' + process.env.cityDomain + config.url
   }
@@ -30,7 +30,7 @@ service.interceptors.response.use(response => {
         const first = sessionId.indexOf(';')
         const second = sessionId.lastIndexOf(';')
         const newSessionId = sessionId.replace(sessionId.substring(first, second), '')
-        store.commit('option/SET_SESSION_ID', newSessionId)
+        // store.commit('option/SET_SESSION_ID', newSessionId)
         break
       }
     }