构建动态路由的时候,前端报以下错误,已经检查过后端的映射和前端的url是一致的,并且后端接口功能测试正常,有人知道是为啥吗?
Error: Cannot find module './processMgr/process/list.vue'
at webpackContextResolve (eval at ./src/views sync recursive ^\.\/.*\.vue$ (app.js:2915:1), :28:11)
at webpackContext (eval at ./src/views sync recursive ^\.\/.*\.vue$ (app.js:2915:1), :23:11)
at module.exports (_import_development.js?595e:2:1)
at eval (permission.js?223d:82:1)
at Array.filter ()
at filterAsyncRouter (permission.js?223d:74:1)
at eval (permission.js?223d:91:1)
at Array.filter ()
at filterAsyncRouter (permission.js?223d:74:1)
at _callee$ (permission.js?223d:37:1)
permission.js?223d:85 Error: Cannot find module './wechat/menu/list.vue'
at webpackContextResolve (eval at ./src/views sync recursive ^\.\/.*\.vue$ (app.js:2915:1), :28:11)
at webpackContext (eval at ./src/views sync recursive ^\.\/.*\.vue$ (app.js:2915:1), :23:11)
at module.exports (_import_development.js?595e:2:1)
at eval (permission.js?223d:82:1)
at Array.filter ()
at filterAsyncRouter (permission.js?223d:74:1)
at eval (permission.js?223d:91:1)
at Array.filter ()
at filterAsyncRouter (permission.js?223d:74:1)
at _callee$ (permission.js?223d:37:1)
permission.js?223d:38 Array(5)
permission.js?223d:50 Error: [vue-router] "path" is required in a route configuration.
at assert (vue-router.esm.js?8c4f:10:1)
at addRouteRecord (vue-router.esm.js?8c4f:1166:1)
at eval (vue-router.esm.js?8c4f:1223:1)
at Array.forEach ()
at addRouteRecord (vue-router.esm.js?8c4f:1219:1)
at eval (vue-router.esm.js?8c4f:1136:1)
at Array.forEach ()
at createRouteMap (vue-router.esm.js?8c4f:1135:1)
at Object.addRoutes (vue-router.esm.js?8c4f:1357:1)
at VueRouter.addRoutes (vue-router.esm.js?8c4f:2643:1)
回答采用chatGPT:
这个错误是因为前端在构建动态路由时,无法找到对应的模块。具体来说,是因为前端在路由配置中引用了一个名为 ./processMgr/process/list.vue 的模块,但是无法在项目中找到该模块。
同样的,前端还引用了一个名为 ./wechat/menu/list.vue 的模块,但也无法找到该模块。
最后一个错误是因为在路由配置中缺少了 path 属性,该属性是必须的。
要解决这个问题,需要检查模块路径是否正确,并确保模块已经存在于项目中。同时,需要检查路由配置是否正确,包括是否缺少必要的属性。