Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

vite build 后找不到动态路由,乡亲们给个思路

### vite生产环境下可以正常运行项目,但是会有个提示
image.png


### 项目打包后,默认的路由是可以访问的,但是访问动态路由后就会提示错误
image.png


### 网上有位仁兄也碰到了类似的问题
https://ostack.cn/q/1010000038281062?_ea=82539365

### 我想我们是碰到的同一个问题,大神们给个思路呗!跪谢跪谢


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

问题还在跟踪中,不过生产环境下图一的错误提示已经解决了即在动态路由调用的地方增加一段注释即可

 import(/* @vite-ignore */`/@/views${view}`);

但是打包好后仍旧提示着找不到文件,头大.......


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...