Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: isFunction is not a function at defineComponent in vite4+vue3+ant-design-vue4 #666

Open
5 tasks done
examyou opened this issue Jul 28, 2023 · 7 comments

Comments

@examyou
Copy link

examyou commented Jul 28, 2023

Describe the bug

I am having following error on running
npm run dev

While it is compiling using
npm run build

Screenshot-2023-07-28-at-8-46-51-AM

vite.config.js

import { defineConfig, splitVendorChunkPlugin } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/js/app.js',
            ]
        }),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
        splitVendorChunkPlugin(),
        Components({
            resolvers: [
                AntDesignVueResolver({
                    importStyle: false, // css in js
                })
            ],
        }),
    ],
    build: {
        // chunkSizeWarningLimit: 900000,
        rollupOptions: {
            output: {
                entryFileNames: `assets/[name].js`,
                chunkFileNames: function (file) {
                    return `assets/[name].js`;
                },
                assetFileNames: (assetInfo) => {
                    return `assets/[name][extname]`;
                },
                manualChunks: {
                    ant_design_vue: ['ant-design-vue']
                }
            }
        }
    },
    server: {
        hmr: {
            host: 'localhost',
        },
    },
});

Reproduction

Reproduction

System Info

System

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@lishaobos
Copy link
Contributor

需要一个可以复现的 git 仓库

@iowxy
Copy link

iowxy commented Sep 12, 2023

需要一个可以复现的 git 仓库

是 AntDesignVueResolver 导致的,删除就不报错了

@iowxy
Copy link

iowxy commented Sep 12, 2023

这个应该是本质原因 unplugin/unplugin-auto-import#323

unplugin-auto-import 降级到 0.12 可解决。

@smallsun-lgtm
Copy link

这个应该是本质原因 unplugin/unplugin-auto-import#323

unplugin-auto-import 降级到 0.12 可解决。

这个我本身写的是unplugin-auto-import :'^0.11.7' 但是现在不好用了,昨天还好用

@iowxy
Copy link

iowxy commented Nov 20, 2023

这个应该是本质原因 unplugin/unplugin-auto-import#323
unplugin-auto-import 降级到 0.12 可解决。

这个我本身写的是unplugin-auto-import :'^0.11.7' 但是现在不好用了,昨天还好用

把脱字符^去掉

@zhuddan
Copy link

zhuddan commented Jan 13, 2025

尝试把项目入口的 import { createApp } from 'vue'放在第一行导入。我用这个方法解决了。

@yiyang0821
Copy link

@zhuddan 太感谢了,困扰了好久的问题解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants