New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question lazy load #6
Comments
Hi @javialon26 Actually no, you have to do it manually, example: import Vue from 'vue'
import Router from 'vue-router'
// lazy load the pages
const MyPage = () => import('~/components/my-page')
Vue.use(Router)
export function createRouter() {
return new Router({
mode: 'history',
routes: [
{
path: '/',
component: MyPage
}
]
})
} |
@Atinux i have an error with this config: [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build. ---> , or missing . Bailing hydration and performing full client-side render. this is my router.js
thank you |
@javialon26 Sorry I forgot something, try with: import Router from 'vue-router'
// import HomePage from '@/components/pages/index.vue'
const HomePage = () => import('@/components/pages/index.vue').then(m => m.default || m)
const HelpPage = () => import('@/components/pages/ayuda.vue').then(m => m.default || m)
Vue.use(Router)
export function createRouter () {
return new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'home',
component: HomePage
},
{
path: '/ayuda',
name: 'ayuda',
component: HelpPage
}
]
})
} |
@Atinux work like a charm, thank you! |
Ran into the same issue when attempting to customize code-splitting. Can confirm that the solution provided by @Atinux ( |
Should this be documented somewhere in the doc ? |
hello @Atinux with this module are the routes still lazy?
The text was updated successfully, but these errors were encountered: