Skip to content

Unknown theme type: undefined, name: undefined at withSuffix #2745

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

Closed
1 task
Torone opened this issue Aug 21, 2020 · 17 comments
Closed
1 task

Unknown theme type: undefined, name: undefined at withSuffix #2745

Torone opened this issue Aug 21, 2020 · 17 comments

Comments

@Torone
Copy link

Torone commented Aug 21, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.6.4

Environment

Any OS, Any Browser, Vue 2.6.11

Reproduction link

http://nothing-to-show.com

Steps to reproduce

1- Create a few Vue components using some ant-design component like icons, buttons, etc...;
2- Create a minimal Rollup configuration to export the project as a library;
3- Build the project;
4- run npm pack to create local npm dependency;
5- create a nuxt application (I'm using nuxt, feel free to try with a normal Vue app);
6- install your local npm package (point 4);
7- in one of your page or component try to import one component from your new library;
8- it crash.

What is expected?

It should not crash... the export should be smooth and I should be able to import my components created on top of ant-design.

What is actually happening?

It crash and I don't know how and what to fix...


The block of code crashing in my .esm file is this one:

function withSuffix(name, theme) {
switch (theme) {
case 'fill':
return name   '-fill';
case 'outline':
return name   '-o';
case 'twotone':
return name   '-twotone';
default:
throw new TypeError('Unknown theme type: '   theme   ', name: '   name);
}
}

It seems to be related to the Icon component. The theme has a default value, that is "outlined" but the case here is looking for "outline". Also "fill" should be "filled" and "twotone" should be "twoTone": https://www.antdv.com/components/icon/

@RiverLoveMU
Copy link

I meet the same question when using Rollup to export my project as a library. If i dont use babel-plugin-import, its ok, but it makes my project too large, do you fix it ?

@Torone
Copy link
Author

Torone commented Oct 14, 2020

I didn't. While waiting for a fix or a solution I just moved this task to my backlog... It is actually impossible. If a solution will not be ready I will just replace Antd with something else.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@jaredhobbs
Copy link

@Torone @RiverLoveMU did either of you find a solution to this? I'm trying to use ant design vue v1.7.3 with vue 2 using vite with vite-plugin-vue2 and I'm hitting the exact same error.

@Torone
Copy link
Author

Torone commented Mar 30, 2021

@jaredhobbs I moved out from this package... Too many bugs by my point of view. Good luck.

@Lpppsea9
Copy link

Lpppsea9 commented Apr 6, 2021

@jaredhobbs me too, I have a vue2+ant-design-vue1.7.4+vite2,and I add vite-plugin-vue2 but I have the same bug with this ,have you solve the bugs?

Uncaught TypeError: Unknown theme type: undefined, name: undefined at withSuffix (utils.js:105) at Icon.js:25 at Array.forEach (<anonymous>) at Object.add (Icon.js:24) at index.js:18

@jaredhobbs
Copy link

@Lpppsea9 unfortunately no. I'm in the process of just updating everything to Vue 3.

@cdll
Copy link

cdll commented May 6, 2021

@jaredhobbs same issue here~

@LenGxien
Copy link

LenGxien commented May 8, 2021

I have the same bug, by viewing the source code, compatibility of vite esmodule is done in ant-design-vue/lib, so you can import Antd from 'ant-design-vue/lib' to solve the bug

@Torone @RiverLoveMU did either of you find a solution to this? I'm trying to use ant design vue v1.7.3 with vue 2 using vite with vite-plugin-vue2 and I'm hitting the exact same error.

@tangjinzhou
Copy link
Member

For antdv 1.x, we do not plan to be compatible with vite, if you have ideas, you can pr

@abear-eatsfish
Copy link

I have the same bug, by viewing the source code, compatibility of vite esmodule is done in ant-design-vue/lib, so you can import Antd from 'ant-design-vue/lib' to solve the bug

@Torone @RiverLoveMU did either of you find a solution to this? I'm trying to use ant design vue v1.7.3 with vue 2 using vite with vite-plugin-vue2 and I'm hitting the exact same error.

ant-design/ant-design#19002 (comment)

最下面的回答,取巧方式临时解决~

@yaohuangguan
Copy link

yaohuangguan commented Jul 28, 2021

For antdv 1.x, we do not plan to be compatible with vite, if you have ideas, you can pr

@tangjinzhou 老哥,vue2好像只能使用antv1.x, vue2 和vite一起使用,再使用andtv 1.x 会有这个问题。如果不支持vite,那怎么办呢? 无法升级到2.x

@abear-eatsfish
Copy link

For antdv 1.x, we do not plan to be compatible with vite, if you have ideas, you can pr

@tangjinzhou 老哥,vue2好像只能使用antv1.x, vue2 和vite一起使用,再使用andtv 1.x 会有这个问题。如果不支持vite,那怎么办呢? 无法升级到2.x

整个包导入就可以使用,相当于浏览器引入,当然就相当于舍弃了这个包按需引入,打包出来也会相对大

@yaohuangguan
Copy link

yaohuangguan commented Jul 28, 2021

不行的,我没有按需导入,就是全部导入。import antd from 'ant-design-vue/lib', Vue.use(antd) 这样 (如果不从/lib目录下导入,会直接报错)。
还是会报这个错误,antv 1.x 版本和vue2 , vite2

@yaohuangguan
Copy link

yaohuangguan commented Jul 29, 2021

@abear-eatsfish 如果从lib导入是可以的,但是this上的$form会undefined,一些form的类型也会没了,会报错

@abear-eatsfish
Copy link

abear-eatsfish commented Jul 29, 2021

@abear-eatsfish 如果从lib导入是可以的,但是this上的$form会undefined,一些form的类型也会没了,会报错

`
import Vue from 'vue'
// import Antd from "ant-design-vue/lib";
import Antd from 'ant-design-vue/dist/antd.min.js'
import 'ant-design-vue/dist/antd.min.css'

Vue.use(Antd)
`
我就是这样用的,打包出来IE11也能运行

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants