Umi中如何实现assets打包的静态资源下动态访问的能力 #12625
Unanswered
blackcorgi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
有大量的静态资源,比如图片和音频,不想放在public中,业务需要放在assets下跟随打包带md5后缀。如 xxx.234234.jpg
在业务中如果批量的import 会影响网络阻塞
希望能在使用的时候动态的传入文件名称访问到。也不影响打包。
按经验 应该是 new URL('./assets/xxxx.jpg', import.meta.url) 获取pathname即可。但在umi中不生效。
求教!
Beta Was this translation helpful? Give feedback.
All reactions