Pan 7 years ago
parent
commit
2161d22630
2 changed files with 13 additions and 4 deletions
  1. 8 1
      .babelrc
  2. 5 3
      package.json

+ 8 - 1
.babelrc

@@ -8,5 +8,12 @@
8
     }],
8
     }],
9
     "stage-2"
9
     "stage-2"
10
   ],
10
   ],
11
-  "plugins": ["transform-vue-jsx", "transform-runtime"]
11
+  "env": {
12
+    "development":{
13
+      "plugins": ["transform-vue-jsx", "transform-runtime", "dynamic-import-node"]
14
+    },
15
+    "production": {
16
+      "plugins": ["transform-vue-jsx", "transform-runtime"]
17
+    }
18
+  }
12
 }
19
 }

+ 5 - 3
package.json

@@ -5,10 +5,10 @@
5
   "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
5
   "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
6
   "author": "Pan <panfree23@gmail.com>",
6
   "author": "Pan <panfree23@gmail.com>",
7
   "scripts": {
7
   "scripts": {
8
-    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
8
+    "dev": "cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9
     "start": "npm run dev",
9
     "start": "npm run dev",
10
-    "build": "node build/build.js",
11
-    "build:report":"npm_config_report=true node build/build.js",
10
+    "build": "cross-env BABEL_ENV=production node build/build.js",
11
+    "build:report": "cross-env BABEL_ENV=production npm_config_report=true node build/build.js",
12
     "lint": "eslint --ext .js,.vue src",
12
     "lint": "eslint --ext .js,.vue src",
13
     "test": "npm run lint"
13
     "test": "npm run lint"
14
   },
14
   },
@@ -28,6 +28,7 @@
28
     "babel-eslint": "8.0.3",
28
     "babel-eslint": "8.0.3",
29
     "babel-helper-vue-jsx-merge-props": "2.0.3",
29
     "babel-helper-vue-jsx-merge-props": "2.0.3",
30
     "babel-loader": "7.1.2",
30
     "babel-loader": "7.1.2",
31
+    "babel-plugin-dynamic-import-node": "1.2.0",
31
     "babel-plugin-syntax-jsx": "6.18.0",
32
     "babel-plugin-syntax-jsx": "6.18.0",
32
     "babel-plugin-transform-runtime": "6.23.0",
33
     "babel-plugin-transform-runtime": "6.23.0",
33
     "babel-plugin-transform-vue-jsx": "3.5.0",
34
     "babel-plugin-transform-vue-jsx": "3.5.0",
@@ -35,6 +36,7 @@
35
     "babel-preset-stage-2": "6.24.1",
36
     "babel-preset-stage-2": "6.24.1",
36
     "chalk": "2.3.0",
37
     "chalk": "2.3.0",
37
     "copy-webpack-plugin": "4.2.3",
38
     "copy-webpack-plugin": "4.2.3",
39
+    "cross-env": "^5.1.1",
38
     "css-loader": "0.28.7",
40
     "css-loader": "0.28.7",
39
     "eslint": "4.13.1",
41
     "eslint": "4.13.1",
40
     "eslint-friendly-formatter": "3.0.0",
42
     "eslint-friendly-formatter": "3.0.0",