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 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 5
   "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
6 6
   "author": "Pan <panfree23@gmail.com>",
7 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 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 12
     "lint": "eslint --ext .js,.vue src",
13 13
     "test": "npm run lint"
14 14
   },
@@ -28,6 +28,7 @@
28 28
     "babel-eslint": "8.0.3",
29 29
     "babel-helper-vue-jsx-merge-props": "2.0.3",
30 30
     "babel-loader": "7.1.2",
31
+    "babel-plugin-dynamic-import-node": "1.2.0",
31 32
     "babel-plugin-syntax-jsx": "6.18.0",
32 33
     "babel-plugin-transform-runtime": "6.23.0",
33 34
     "babel-plugin-transform-vue-jsx": "3.5.0",
@@ -35,6 +36,7 @@
35 36
     "babel-preset-stage-2": "6.24.1",
36 37
     "chalk": "2.3.0",
37 38
     "copy-webpack-plugin": "4.2.3",
39
+    "cross-env": "^5.1.1",
38 40
     "css-loader": "0.28.7",
39 41
     "eslint": "4.13.1",
40 42
     "eslint-friendly-formatter": "3.0.0",