question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Refine Antd + Vite fails in production build

See original GitHub issue

Describe the bug

I think it’s an issue similar to https://bytemeta.vip/repo/rjsf-team/react-jsonschema-form/issues/2962

When building a project with Refine/Antd and Vite there’s an error on the browser generatePickerExports is not a function. It seems that the issue is due to imports from CommonJS modules in AntD and not ESModules as vite requires.

I’ve patched node_modules/@pankod/refine-antd/dist/esm/index.js to make it work (replacing picker imports from lib to es and it seem to resolve the issue.

Steps To Reproduce

  1. Create a new refine project with Antd and Vite.
  2. Set build: { minify: false }, in vite.config.ts.
  3. npm run build
  4. npm run preview
  5. Open a browser and see the error

Expected behavior

Production build should work.

Screenshot

No response

Desktop

  • OS: Mac OS 13
  • Chrome 108
  • Deployment with Vercel

Mobile

No response

Additional Context

No response

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
omeraplakcommented, Dec 16, 2022

Hey, We’ve fixed this issue. Thank you @nirga @aliemir @leapful 🚀

1reaction
omeraplakcommented, Dec 13, 2022

Hey, Thank you @leapful for the information 🎉 We will release antd@5 support this week. Could this problem be solved with @5? @yildirayunlu can you test it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

vite build fail when use define · Issue #2700 · vitejs/vite - GitHub
This is code come froms /antd/es/locale/zh_CN.js . If you use define to replace global , please make sure it is a correct replacer....
Read more >
Refine Antd Example (forked) - StackBlitz
Run official live example code for Refine Antd, created by Pankod on StackBlitz. ... production. /build. # misc .DS_Store .env.local .env.development.local.
Read more >
Vite and Antd error -> [vite:css] Inline JavaScript is not enabled ...
pnpm/antd@4.21.4_react-dom@17.0.2+react@17.0.2/node_modules/antd/es/date-picker/style/index.less:110:0 error during build: Error: Inline ...
Read more >
Which UI framework I need to pick between chakra, material ...
It will be very large and lot of modules are needed to build. ... I am considering Material, Antd and Chakra UI. ......
Read more >
Use in TypeScript - Ant Design
We build antd based on latest stable version of TypeScript ( >=4.0.0 ), please make sure your project dependency matches it. Install and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found