这个插件中有类似的代码 https://ext.dcloud.net.cn/plugin?id=1987
- 发布:2024-05-21 15:30
- 更新:2024-08-30 11:34
- 阅读:388
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 4.17
手机系统: Android
手机系统版本号: Android 14
手机厂商: 小米
手机机型: 红米k40
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
<script module="leaflet" lang="renderjs">
import '/libs/leaflet/leaflet.css';
import '@/libs/leaflet/Leaflet.markercluster/MarkerCluster.css';
import '@/libs/leaflet/Leaflet.markercluster/MarkerCluster.Default.css';
import L from '@/libs/leaflet/leaflet'
import '@/libs/leaflet/leaflet.ChineseTmsProviders.js'
import '@/libs/leaflet/leaflet.mapCorrection.js'
import '@/libs/leaflet/terraformer'
import Terraformer from '@/libs/leaflet/terraformer-wkt-parser'
import '@/libs/leaflet/Leaflet.markercluster/leaflet.markercluster.js';
<script module="leaflet" lang="renderjs">
import '/libs/leaflet/leaflet.css';
import '@/libs/leaflet/Leaflet.markercluster/MarkerCluster.css';
import '@/libs/leaflet/Leaflet.markercluster/MarkerCluster.Default.css';
import L from '@/libs/leaflet/leaflet'
import '@/libs/leaflet/leaflet.ChineseTmsProviders.js'
import '@/libs/leaflet/leaflet.mapCorrection.js'
import '@/libs/leaflet/terraformer'
import Terraformer from '@/libs/leaflet/terraformer-wkt-parser'
import '@/libs/leaflet/Leaflet.markercluster/leaflet.markercluster.js';
预期结果:
正常编译,测试vue2是没有问题的
正常编译,测试vue2是没有问题的
实际结果:
编译报错You can mark the path "@/libs/leaflet/terraformer-wkt-parser" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
编译报错You can mark the path "@/libs/leaflet/terraformer-wkt-parser" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
bug描述:
vue3的renderjs中使用import 引入 报错 You can mark the path "@/libs/leaflet/Leaflet.markercluster/MarkerCluster.css" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
感谢反馈,你提到 renderjs 种引入相关逻辑在 vue2 中没有问题,在 vue3 种报错,有和作者进行反馈沟通吗?我尝试使用简单的 demo 尝试复现,也希望提供完整工程,提供更多信息有助于复现和定位你的问题
2***@qq.com (作者)
我单独创建了个空项目确实可以引入,稍后我在测测是什么原因。
2024-05-23 16:06
DCloud_UNI_OttoJi
回复 2***@qq.com: 我和同事沟通了下,的确在 vue3 + renderjs 中没有完全对齐 vue2 的功能,主要涉及
@
符号需要调整为相对路径,css 内 url 需要适配调整2024-05-23 17:57
2***@qq.com (作者)
回复 DCloud_UNI_OttoJi: 好的感谢回复
2024-06-04 18:19