how to import async router whit vite #13524
Unanswered
weihong991010
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
when i use vite rule to import async router in vue2.7 porject, it report a error in broswer.The page sturct are as follow :
adn my router config are as follow:
const moduleMap = import.meta.glob('../views/*/**.vue'); const routes = [ { path: '/', redirect: '/home' }, { path: '/home', name: 'hpme', component: moduleMap['../views/home/index.vue'], meta: { title: '主页 } } ]
it report error in broswer
i think iits caused by not mapping file, because there are no chunk .js change when router redirect.
my vite is 3.0.0 、node14.21.2.、 vue2.7、vue-router3.5
Beta Was this translation helpful? Give feedback.
All reactions