Is there is a performance or behavioural difference between importing from an index file or importing individual modules?
For example, with an index file (@/modules/user
) of...
import routes from './routes'
import controller from './controller'
const user = {
routes,
controller
}
export default user
If I import just the routes from that file...
import user from '@/modules/user'
const routes = Router()
routes.use('/user', user.routes)
Is this any different to just importing the routes individually from their own file (@/modules/user/routes
)? Does the controller get imported as it's in the user object?
import userRoutes from '@/modules/user/routes'
const routes = Router()
routes.use('/user', userRoutes)