unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue

Home Page:https://www.npmjs.com/package/unplugin-vue-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(vite2+vue3+ant-design-vue3) use 组件时 出现不明的 Uncaught TypeError: isFunction is not a function

langyamu opened this issue · comments

基于 这个模板

详细报错信息:

Uncaught TypeError: isFunction is not a function
    at defineComponent (runtime-core.esm-bundler.js:2244:12)
    at LocaleReceiver.js:4:16

main.ts 只要use 就会报错

import '@/styles/reset.css';
import { Calendar, Modal } from 'ant-design-vue';
import { createApp } from 'vue';
import App from './App.vue';
// createApp(App).use(Calendar).use(Modal).mount('#app');
createApp(App).use(Calendar).use(Modal).mount('#app');

vite.config.ts

import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
    const isDev: boolean = mode === 'development';
    // https://vitejs.dev/config/
    return {
        base: isDev ? '' : '/widgets/calendar',
        plugins: [
            vue(),
            Components({
                resolvers: [AntDesignVueResolver()],
            }),
        ],
        resolve: {
            //设置别名
            alias: {
                '@': path.resolve(__dirname, 'src'),
            },
        },
        server: {
            port: 8080, //启动端口
            hmr: {
                host: '127.0.0.1',
                port: 8080,
            },
            // 设置 https 代理
            proxy: {
                '/api': {
                    target: 'http://127.0.0.1:68066',
                    changeOrigin: true,
                    // rewrite: (path: string) => path.replace(/^\/api/, '')
                },
            },
        },
        build: {
            outDir: '',
        },
    };
});

朋友,请问这个问题是如何解决的哇

这个问题好恶心啊,我写了半天发现给我报错了

出现了同样的问题 ,请问怎么解决?

最新版本还是报错 @bryne-k
"vue": "3.2.47",
"unplugin-auto-import": "^0.15.3",
"unplugin-vue-components": "^0.24.1",
"vite": "4.3.4",

好的 我试试

还是报错 目前只能这样用这个插件了@bryne-k
image

fix 了吗?issue 怎么关了