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

vite-react初始化的项目无法使用antd #48888

Closed
wanghao1993 opened this issue May 12, 2024 · 2 comments
Closed

vite-react初始化的项目无法使用antd #48888

wanghao1993 opened this issue May 12, 2024 · 2 comments

Comments

@wanghao1993
Copy link

Reproduction link

https://github.com/wanghao1993/react-admin.git

Steps to reproduce

直接安装依赖,启动就会看到错误。

What is expected?

期望能够正常运行

What is actually happening?

只要使用组件就会报错,
This error came from the "onResolve" callback registered here:

node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1293:20:
  1293 │       let promise = setup({
       ╵                     ^


node_modules/.pnpm/antd@5.17.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/es/notification/PurePanel.js:19:23:
  19 │ import { Notice } from 'rc-notification';
     ╵                        ~~~~~~~~~~~~~~~~~

✘ [ERROR] Failed to resolve entry for package "@ant-design/cssinjs". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-pre-bundle]

node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1374:21:
  1374 │         let result = await callback({
       ╵                      ^
Environment Info
antd 5.17.0
React 18.2.0
System MacOs14.4.1
Browser chrome 124.0.6367.91
@Wxh16144
Copy link
Member

你的 vite config 为啥只 resolve .tsx 文件呢🤔?

     react(),
   ],
   resolve: {
-    extensions: [".tsx"],
+    // extensions: [".tsx"],
     alias: [
       {
         find: "@",

@afc163 afc163 closed this as completed May 13, 2024
@wanghao1993
Copy link
Author

sorry. 阿西吧 低级错误-

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

No branches or pull requests

3 participants