dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.14k stars 3.63k forks source link

震惊! vant3、4在uniapp上出现这bug,vant表示uniapp的锅 #3984

Open Verdicts-ye opened 2 years ago

Verdicts-ye commented 2 years ago

问题描述 [问题描述:尽可能简洁清晰地把问题描述清楚] 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小程序报错。 [或者可以直接贴源代码]

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

实际结果 报错

系统信息:

realwds commented 1 year ago

问题解决了吗 我也遇到了

Verdicts-ye commented 1 year ago

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: @.***>

realwds commented 1 year ago

害,没有啥像样的多端UI

Verdicts-ye commented 1 year ago

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: @.***>

huaerss commented 10 months ago

还没解决这个问题吗

Verdicts-ye commented 9 months ago

换别的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: @.***>