dci797
dci797
  • 发布:2025-02-27 15:30
  • 更新:2025-02-28 14:59
  • 阅读:64

【报Bug】vue3使用renderjs引入css报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 11 企业版

HBuilderX类型: 正式

HBuilderX版本号: 4.45

手机系统: Android

手机系统版本号: Android 15

手机厂商: vivo

手机机型: iqoonew8

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

<script module="photo" lang="renderjs">
import "@photo-sphere-viewer/core/index.css";
</script >

操作步骤:

安装photo-sphere-viewer,引入css报错·

预期结果:

正常打包

实际结果:

打包报错误
15:24:40.890 X [ERROR] Cannot import "E:/Code/TT/node_modules/@photo-sphere-viewer/core/index.css" into a JavaScript file without an output path configured
15:24:40.900 <stdin>:16:8:
15:24:40.907 16 │ import "@photo-sphere-viewer/core/index.css";
15:24:40.946 ╵ ~~~~~~~~~
15:24:40.962 [plugin:uni:app-vue-renderjs] Build failed with 1 error:
15:24:40.968 <stdin>:16:8: ERROR: Cannot import "E:/Code/TT/node_modules/@photo-sphere-viewer/core/index.css" into a JavaScript file without an output path configured

bug描述:

vue3使用renderjs引入css报错,vue2不会报错可以正常使用

2025-02-27 15:30 负责人:DCloud_UNI_yuhe 分享
已邀请:
DCloud_UNI_OttoJi

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信

提供个复现工程,并且手动测试一下,把对应的 css 文件修改成相对路径引用。对比测试 vue2 和 vue3 是不是就一样了,缩小下问题范围,是不是相对路径的问题。

要回复问题请先登录注册