h***@foxmail.com
h***@foxmail.com
  • 发布:2024-06-26 16:49
  • 更新:2024-07-04 14:29
  • 阅读:107

vue3+renderjs导出图片报错

分类:uni-app
16:44:44.865 X [ERROR] Could not resolve "/static/ship.svg"  
16:44:44.878     <stdin>:32:23:  
16:44:44.887       32 │   import shipIcon from "/static/ship.svg"  
16:44:44.897          ╵                        ~~~~~~~~~~~~~~~~~~  
16:44:45.076 [plugin:uni:app-vue-renderjs] Build failed with 1 error:  
16:44:45.083 <stdin>:32:23: ERROR: Could not resolve "/static/ship.svg"

改成相对路径:

16:49:55.000 X [ERROR] No loader is configured for ".svg" files: ../../../demo/static/ship.svg  
16:49:55.006     <stdin>:32:23:  
16:49:55.014       32 │   import shipIcon from "../static/ship.svg"  
16:49:55.020          ╵                        ~~~~~~~~~~~~~~~~~~~~  
16:49:55.035 [plugin:uni:app-vue-renderjs] Build failed with 1 error:  
16:49:55.044 <stdin>:32:23: ERROR: No loader is configured for ".svg" files: ../../../demo/static/ship.svg

放在同级目录:

16:51:19.354     <stdin>:32:23:  
16:51:19.359       32 │   import shipIcon from "./ship.svg"  
16:51:19.366          ╵                        ~~~~~~~~~~~~  
16:51:19.375 [plugin:uni:app-vue-renderjs] Build failed with 1 error:  
16:51:19.382 <stdin>:32:23: ERROR: No loader is configured for ".svg" files: ../../../demo/components/ship.svg

有什么解决办法?

2024-06-26 16:49 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com - 学习中

请问问题解决了吗》??

  • h***@foxmail.com (作者)

    解决了,不用import, 改成了const shipIcon = "static/ship.svg"

    2024-07-03 17:17

1***@qq.com

1***@qq.com - 学习中

好吧 但是我用的插件里面出现这种情况

要回复问题请先登录注册