Unknown problems introduced by import

test.js

import store from "./store"
import config from "./../config/config"
import routes from "./../../router/index"
let saveData = store.fetch()
console.log(store)  // 
console.log(config)  // 
console.log(routes)  // undefined

ask the great god for advice!

= supplement =

router/index.js is as follows

import Vue from "vue"
import Router from "vue-router"

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: "/",
      name: "login",
      component: require("@/components/Login/login").default
    },
    {
      path: "/admin",
      name: "admin",
      component: require("@/components/Admin/app").default
    },
    {
      path: "*",
      redirect: "/"
    }
  ]
})

= add 2.16 =
actually my purpose is to call router.push in test.js to jump.
test.js is in the modules directory

clipboard.png

Jun.20,2022

introduce undefined just because you can't find the file, or there is no export in that file


introduces the path problem, and why do you add a. /? just import routes from'.. /.. / router'.


import routes from'. /.. /.. / router/index'
remove'/ index' or write as'/ index.js'


 component: require('@/components/Admin/app').default

 require
Menu