Skip to content

Commit 2ea998f

Browse files
committed
chore: use babel-plugin-dynamic-import-node
1 parent 14702ac commit 2ea998f

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

.env.development

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,3 @@ ENV = 'development'
33

44
# base api
55
VUE_APP_BASE_API = '/dev-api'
6-
7-
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
8-
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
9-
# It only does one thing by converting all import() to require().
10-
# This configuration can significantly increase the speed of hot updates,
11-
# when you have a large number of pages.
12-
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
13-
14-
VUE_CLI_BABEL_TRANSPILE_MODULES = true

babel.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
module.exports = {
22
presets: [
3+
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
34
'@vue/cli-plugin-babel/preset'
4-
]
5+
],
6+
'env': {
7+
'development': {
8+
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
9+
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
10+
// https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
11+
'plugins': ['dynamic-import-node']
12+
}
13+
}
514
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"dependencies": {
1818
"axios": "0.18.1",
19+
"babel-plugin-dynamic-import-node": "2.3.3",
1920
"clipboard": "2.0.4",
2021
"codemirror": "5.45.0",
2122
"core-js": "3.6.5",

0 commit comments

Comments
 (0)