无
- 发布:2023-05-23 16:28
- 更新:2024-09-04 09:52
- 阅读:4820
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows10
HBuilderX类型: 正式
HBuilderX版本号: 3.8.2
第三方开发者工具版本号: 1.06.2304191win32-x64
基础库版本号: 2.32.0
项目创建方式: HBuilderX
操作步骤:
预期结果:
无
无
实际结果:
uni-data-picker 组件报错 :[vite]: Rollup failed to resolve import "D:/code/HBuilderCode/dipin---wechat-mini-program/src/components/data-picker-view.vue" from "D:/code/HBuilderCode/dipin---wechat-mini-program/src/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
uni-data-picker 组件报错 :[vite]: Rollup failed to resolve import "D:/code/HBuilderCode/dipin---wechat-mini-program/src/components/data-picker-view.vue" from "D:/code/HBuilderCode/dipin---wechat-mini-program/src/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
bug描述:
<template>
<CustomNavigationBarBg ref="headreRef" />
<div
class="cont"
:style="{ paddingTop: `${headreRef ? headreRef!.headerHeight : 0 }rpx` }"
>
<HeaderBar @change="handleChange"></HeaderBar>
<LateralWheelSeeding></LateralWheelSeeding>
<!-- <UniDataPick></UniDataPick> -->
<!-- 这里的组件不报错 -->
<uni-data-select></uni-data-select>
<uni-swipe-action></uni-swipe-action>
<!-- bug start 使用以下扩展组件时报错,使用其他组件正常,同样的报错还有其他组件 -->
<uni-data-picker></uni-data-picker>
<!-- bug end -->
<!-- 报错内容: [vite]: Rollup failed to resolve import "D:/code/HBuilderCode/dipin---wechat-mini-program/src/components/data-picker-view.vue" from "D:/code/HBuilderCode/dipin---wechat-mini-program/src/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external` -->
</div>
</template>
<script setup lang="ts" name="tab-1">
import type CustomNavigationBarBg from "@/components/CustomNavigationBarBg.vue";
import type AreDataType from "@/components/HeaderBar.vue";
// import UniDataPick from "@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue";
const headreRef = ref<InstanceType<typeof CustomNavigationBarBg> | null>(null);
const handleChange = (data: InstanceType<typeof AreDataType>[]) => {
console.log("收到:", data);
};
</script>
<style scoped lang="scss">
.cont {
width: 100%;
padding: 0 15rpx;
box-sizing: border-box;
}
</style>
6 个回复
1***@qq.com - mynameisjoe
解决了么? 我也遇到同样的问题,部分组件,例如button,input这样的简单组件可以用,uni-data-picker 还有一些其他的就会报这个错误,不能用。 同 vite + ts +vue3 项目
l***@126.com
我也出现该问题,其他组件可以,就是picker 不行,vite + vue3
1***@qq.com
我好好奇就咱们几个遇到这样的问题么
2023-06-25 17:11
y***@163.com
在处理多文件封装formdata上传时,碰到相同的问题。同 vite + ts +vue3 项目。
按照报错在vite.config.ts中配置
build: {
rollupOptions: {
external: [‘miniprogram-formdata’],
},
}
vscode编译后控制台不报错,但微信开发者工具下报错module 'api/miniprogram-formdata.js' is not defined, require args is 'miniprogram-formdata'
莫名其妙,不知道怎么解决
1***@qq.com
应该就是多文件封装问题,uni 判断找不到路径,应该是简单引入弄出的问题,我在尝试其他方式导入组件试试看还有没有这个问题。
2023-06-28 09:30
t***@qq.com
以我之前改vue3的经历,是easycom规则没有生效,我用unplugin-vue-components 解决了这个问题,但是具体需要你自己看看是不是一样的原因
小明子
qqqqq
乔小猿
目前发现是类库版本高的问题,改成低版本就好了
"@dcloudio/types": "^3.4.8",
"@dcloudio/uni-automator": "3.0.0-4000820240401001",
"@dcloudio/uni-cli-shared": "3.0.0-4000820240401001",
"@dcloudio/uni-stacktracey": "3.0.0-4000820240401001",
"@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001",