无
- 发布:2023-05-23 16:28
- 更新:2024-12-08 11:01
- 阅读:5823
产品分类: 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>
1***@qq.com - mynameisjoe
解决了么? 我也遇到同样的问题,部分组件,例如button,input这样的简单组件可以用,uni-data-picker 还有一些其他的就会报这个错误,不能用。 同 vite + ts +vue3 项目
在处理多文件封装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'
莫名其妙,不知道怎么解决
目前发现是类库版本高的问题,改成低版本就好了
"@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",
请问这个问题咋解决啊 我用uni-list也遇到了这个问题
-
// "easycom": {
// "autoscan": true,
// "custom": {
// "^u--(.)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
// "^up-(.)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
// "^u-([^-].)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"
// }
// },
"easycom": {
"autoscan": true,
"custom": {
// uni-ui 规则如下配置
"^uni-(?!im-list)(.)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
},2024-12-09 10:31
z***@163.com
请问解决了吗
2024-11-13 10:40