[BUG] Refine Antd + Vite fails in production build
See original GitHub issueDescribe 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
- Create a new refine project with Antd and Vite.
- Set
build: { minify: false },
invite.config.ts
. npm run build
npm run preview
- 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:
- Created 9 months ago
- Comments:7 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, We’ve fixed this issue. Thank you @nirga @aliemir @leapful 🚀
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?