2021年4月8日星期四

Issue when I try to use lazyload with vuejs

Hi I am trying to use lazyload with VueJs my code is this one:

window.Vue = require('vue');  import VueRouter from 'vue-router';  Vue.use(VueRouter);  function lazyLoad(view){    return() => import(`../views/${view}.vue`)  }    export default new VueRouter({    mode: 'history',    base: process.env.BASE_URL,    routes: [     {       path: '/account',       name: 'account',       component: lazyLoad('Account')     }   ]  });  

When I do this, it displays this error:

ERROR in ./resources/js/assets/router.js  Module not found: Error: Can't resolve '../views' in '/home/jysparki/public_html/resources/js/assets'  @ ./resources/js/assets/router.js 7:11-51  @ ./resources/js/app.js  @ multi ./resources/js/app.js ./resources/sass/app.scss  

whot could the problem be?

Thanks

https://stackoverflow.com/questions/67014137/issue-when-i-try-to-use-lazyload-with-vuejs April 09, 2021 at 10:07AM

没有评论:

发表评论