Split my routes.js
-
Hi guys,
I’m trying to split my routes.js file into several files for structure purpose.
Any tip on how to do this?
Something like this:
const routes = [ { path: '/', component: () => import('layouts/Default.vue'), children: [ require('./allroutes/routegroup1.js'), require('./allroutes/routegroup2.js'), require('./allroutes/routegroup3.js') ] } ] // Always leave this as last one if (process.env.MODE !== 'ssr') { routes.push({ path: '*', component: () => import('pages/Error404.vue') }) } export default routes
Thank you.
-
You’d need to import them. There is a couple of ways to do it. This repo shows a modular way and by concatenating the route definitions together.
https://github.com/disjfa/kazoo
Scott
-
@s-molinari , thank you so much