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
有什么解决办法?
h***@foxmail.com (作者)
解决了,不用import, 改成了const shipIcon = "static/ship.svg"
2024-07-03 17:17