uni-app 震惊! vant3、4在uniapp上出现这bug,vant表示uniapp的锅

bxpogfeg  于 4个月前  发布在  uni-app
关注(0)|答案(6)|浏览(63)

问题描述
[问题描述:尽可能简洁清晰地把问题描述清楚]
vite 配置插件报错 ,错误信息如下
'vShow' is not exported by node_modules/.pnpm/registry.npmmirror.com+@dcloudio+uni-mp-vue@3.0.0-alpha-3060720221018006/node_modules/@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js, imported by node_modules/vant/es/overlay/Overlay.mjs;
1: import { withDirectives as _withDirectives, createVNode as _createVNode, vShow as _vShow } from "vue";
2: import { ref, Transition, defineComponent } from "vue";
3: import { isDef, extend, truthProp, numericProp, unknownProp, preventDefault, createNamespace, getZIndexStyle } from "../utils/index.mjs";
复现步骤
[复现问题的步骤]
1.vite.config.ts配置

import { defineConfig } from "vite";

import uni from "@dcloudio/vite-plugin-uni";
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers'
import viteCompression from 'vite-plugin-compression';
import path from 'path'
const srcpath = path.resolve(__dirname, "src")
export default defineConfig({
	resolve: {
		alias: {
			"@": srcpath,
			'components': path.resolve(__dirname, 'src/components')
		},
	},
	build: {
		rollupOptions: {
			external: ['@vant/use','@vant/popperjs']
		}
	},
	// 插件
	plugins: [
		uni(),
		viteCompression({ algorithm: 'gzip' }),
		// unocss(),
		vueSetupExtend(),
		// 自动引入
		AutoImport({
			dts: `${srcpath}/config/dts/auto-import.d.ts`,
			imports: ['vue'],
			resolvers: [
				VantResolver(),
			]
		}),

		Components({
			dts: `${srcpath}/config/dts/componentst.d.ts`,
			resolvers: [
				VantResolver(),
			],
		}),
	],
});

运行wx小程序报错。
[或者可以直接贴源代码]

预期结果
可使用自动导入,编译成功

实际结果
报错

系统信息:

  • 发行平台: 微信小程序

  • 操作系统 [如 iOS 12.1.2、Android 7.0]

  • HBuilderX版本 3.6.8.20221027-alpha

  • uni-app版本 [如使用Vue-cli创建/运行项目,则提供 npm run info 的运行结果]

dldeef67

dldeef671#

问题解决了吗 我也遇到了

z5btuh9x

z5btuh9x2#

vant不处理, 也不适配UNIAPP…

------------------ 原始邮件 ------------------ 发件人: "dcloudio/uni-app" ***@***.***>; 发送时间: 2023年5月5日(星期五) 下午3:39 ***@***.***>; ***@***.******@***.***>; 主题: Re: [dcloudio/uni-app] 震惊! vant3、4在uniapp上出现这bug,vant表示uniapp的锅 (Issue #3984) 问题描述 [问题描述:尽可能简洁清晰地把问题描述清楚] vite 配置插件报错 ,错误信息如下 'vShow' is not exported by ***@***.******@***.******@***.***/uni-mp-vue/dist/vue.runtime.esm.js, imported by node_modules/vant/es/overlay/Overlay.mjs; 1: import { withDirectives as _withDirectives, createVNode as _createVNode, vShow as _vShow } from "vue"; 2: import { ref, Transition, defineComponent } from "vue"; 3: import { isDef, extend, truthProp, numericProp, unknownProp, preventDefault, createNamespace, getZIndexStyle } from "../utils/index.mjs"; 复现步骤 [复现问题的步骤] 1.vite.config.ts配置 import { defineConfig } from "vite"; import uni from ***@***.***/vite-plugin-uni"; import vueSetupExtend from 'vite-plugin-vue-setup-extend'; import AutoImport from 'unplugin-auto-import/vite'; import Components from 'unplugin-vue-components/vite'; import { VantResolver } from 'unplugin-vue-components/resolvers' import viteCompression from 'vite-plugin-compression'; import path from 'path' const srcpath = path.resolve(__dirname, "src") export default defineConfig({ resolve: { alias: { "@": srcpath, 'components': path.resolve(__dirname, 'src/components') }, }, build: { rollupOptions: { external: ***@***.******@***.***/popperjs'] } }, // 插件 plugins: [ uni(), viteCompression({ algorithm: 'gzip' }), // unocss(), vueSetupExtend(), // 自动引入 AutoImport({ dts: ${srcpath}/config/dts/auto-import.d.ts, imports: ['vue'], resolvers: [ VantResolver(), ] }), Components({ dts: ${srcpath}/config/dts/componentst.d.ts, resolvers: [ VantResolver(), ], }), ], }); 运行wx小程序报错。 [或者可以直接贴源代码] 预期结果 可使用自动导入,编译成功 实际结果 报错 系统信息: 发行平台: 微信小程序 操作系统 [如 iOS 12.1.2、Android 7.0] HBuilderX版本 3.6.8.20221027-alpha uni-app版本 [如使用Vue-cli创建/运行项目,则提供npm run info的运行结果] 问题解决了吗 我也遇到了 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>

v1uwarro

v1uwarro3#

害,没有啥像样的多端UI

gudnpqoy

gudnpqoy4#

uviewui 出了Vue3版本…

------------------ 原始邮件 ------------------ 发件人: "dcloudio/uni-app" ***@***.***>; 发送时间: 2023年5月7日(星期天) 凌晨0:29 ***@***.***>; ***@***.******@***.***>; 主题: Re: [dcloudio/uni-app] 震惊! vant3、4在uniapp上出现这bug,vant表示uniapp的锅 (Issue #3984) 害,没有啥像样的多端UI — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>

mxg2im7a

mxg2im7a5#

还没解决这个问题吗

ru9i0ody

ru9i0ody6#

换别的ui吧 , vant并不好支持uniapp , …

------------------ 原始邮件 ------------------ 发件人: "dcloudio/uni-app" ***@***.***>; 发送时间: 2024年1月17日(星期三) 下午5:13 ***@***.***>; ***@***.******@***.***>; 主题: Re: [dcloudio/uni-app] 震惊! vant3、4在uniapp上出现这bug,vant表示uniapp的锅 (Issue #3984) 还没解决这个问题吗 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>

相关问题