由于要适配鸿蒙next,需要将项目由vue2提升到vue3
在vue3中不支持 require 动态引入资源
原来代码:
<script>
export default {
data() {
return {
menu: [{
name: '办文单',
code: '0',
isShow: true,
badge: '',
toUrl: '/pages/kszw/homepage/bwd/bwdList?menu=' + '办文单',
pictureUrl: require('@/static/tab_bwd.png')
}]
}}}
</script>
修改后的代码:require改为() => import
<script>
export default {
data() {
return {
menu: [{
name: '办文单',
code: '0',
isShow: true,
badge: '',
toUrl: '/pages/kszw/homepage/bwd/bwdList?menu=' + '办文单',
pictureUrl: () => import('@/static/tab_bwd.png')
}]
}}}
编译报错:
17:15:54.680 Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.
请问有无大佬知道怎么修改?
2***@qq.com (作者)
已解决,谢谢大佬
2024-10-25 18:24