(vue-deploy) - Cannot find module (Error: Cannot find module '@/views/index')

1. I used Ruoyi’s code, used the Qiankun plug-in to debug, then uninstalled Qiankun, and then performed other operations, and found that the development environment imported components normally. 2. After going
online, the routing could not find the component module. Loading is also import import

Discovery:
Ruoyi's development environment obtains the permission routing from the backend, and uses the routing component loaded by requre when processing it, while in the production environment, it uses import, which is a lazy loading method to import components, which is puzzling
. , why the import import fails

//vue.config 中的打包路径是这么配置的
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",

1. Use requre to import it first, and look forward to someone who is destined to answer.
2. I searched the Internet again and said to try the following, but I still can’t find the module

() => eval(import(`@/views/${
      
      view}`))

Guess you like

Origin blog.csdn.net/weixin_45475798/article/details/127814722