Tencent / tdesign-vue-next

A Vue3.x UI components lib for TDesign.
https://tdesign.tencent.com/vue-next
MIT License
1.43k stars 460 forks source link

[组件自动引入] 任何以字母T开头命名的枚举对象都无法正确地导入 #3909

Open polarove opened 8 months ago

polarove commented 8 months ago

tdesign-vue-next 版本

1.8.0

重现链接

https://stackblitz.com/edit/vitejs-vite-rbldp3?file=src%2Fenum.ts,src%2FApp.vue,package.json,src%2Fmain.ts&terminal=dev

重现步骤

Prerequisites: unplugin-vue-components && unplugin-auto-import && tdesign-vue-next installed Follow the official instructions to use these third part plugins

When we have any enum that its name starts with the word T:

export enum THEME {
    LIGHT
}

And use it:

import { THEME } from `~`
console.log(THEME.LIGHT)

期望结果

枚举对象可以从正确的路径导入

实际结果

枚举对象的导入路径被错误地重写并指向了tdesign-vue-next.js

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/tdesign-vue-next.js?v=e1b92d83' does not provide an export named 'HEME2' (at enum.ts:1:10)

框架版本

Vue(3.4.15)

浏览器版本

Chromium (121.0.2277.83)

系统版本

Windows 10 10.0.19045

Node版本

20.9.0

补充说明

系统和开发环境信息 System: OS: Windows 10 10.0.19045 CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor Memory: 4.46 GB / 15.95 GB Binaries: Node: 20.9.0 - C:\DevTool\node\node.EXE Yarn: 1.22.21 - C:\DevTool\node\yarn.CMD npm: 10.1.0 - C:\DevTool\node\npm.CMD pnpm: 8.10.5 - C:\DevTool\node\pnpm.CMD Browsers: Edge: Chromium (121.0.2277.83) Internet Explorer: 11.0.19041.3636

github-actions[bot] commented 8 months ago

👋 @polarove,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

polarove commented 8 months ago

pnpm 和 npm 都会出现这个问题