Skip to content

Commit 4537fdd

Browse files
committed
use dynamic import instead of System.import
1 parent 6a243c6 commit 4537fdd

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"presets": [
33
["env", { "modules": false }]
4+
],
5+
"plugins": [
6+
"syntax-dynamic-import"
47
]
58
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"autoprefixer": "^6.7.7",
3434
"babel-core": "^6.24.1",
3535
"babel-loader": "^6.4.1",
36+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
3637
"babel-preset-env": "^1.4.0",
3738
"css-loader": "^0.28.0",
3839
"file-loader": "^0.11.1",

src/router/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Router from 'vue-router'
44
Vue.use(Router)
55

66
// route-level code splitting
7-
const createListView = id => () => System.import('../views/CreateListView').then(m => m.default(id))
8-
const ItemView = () => System.import('../views/ItemView.vue')
9-
const UserView = () => System.import('../views/UserView.vue')
7+
const createListView = id => () => import('../views/CreateListView').then(m => m.default(id))
8+
const ItemView = () => import('../views/ItemView.vue')
9+
const UserView = () => import('../views/UserView.vue')
1010

1111
export function createRouter () {
1212
return new Router({

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ babel-plugin-syntax-async-functions@^6.8.0:
362362
version "6.13.0"
363363
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"
364364

365+
babel-plugin-syntax-dynamic-import@^6.18.0:
366+
version "6.18.0"
367+
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da"
368+
365369
babel-plugin-syntax-exponentiation-operator@^6.8.0:
366370
version "6.13.0"
367371
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"

0 commit comments

Comments
 (0)