Importing `generatePicker` from `lib` does not respect locale
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
follow replace moment.js then try to change the locale.
What is expected?
DatePicker locale to change.
What is actually happening?
DatePicker locale does not change
Environment | Info |
---|---|
antd | 4.13.0 |
React | 17.0.1 |
System | win 10 |
Browser | edge 88 |
Importing from es
(antd/es/date-picker/generatePicker
) works, but I’m using next.js, and server-side rendering throws module error (Cannot use import statement outside a module
), but on hot-refresh (client-side) it works.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Dynamic import: cannot find module 'antd/lib/locale/zh_CN'
I find the answer here: solved it by adding plugins: ["@babel/plugin-transform-modules-commonjs"].
Read more >A Guide to React Localization with i18next
React-i18next is a powerful set of components, hooks, and plugins that sit on top of i18next. Learn how to use it to internationalize...
Read more >ConfigProvider
In the render tree all components will have access to the provided config. import { ConfigProvider } from 'antd'; ... Change locale of...
Read more >Locale Packs
38 Locales NPM CDN Source on GitHub
Arabic Saudi Arabia @uppy/locales/lib/ar_SA ar_SA.min.js ✏️ ar_SA.js
Bulgarian Bulgaria @uppy/locales/lib/bg_BG bg_BG.min.js ✏️ bg_BG.js
Chinese China @uppy/locales/lib/zh_CN zh_CN.min.js ✏️ zh_CN.js...
Read more >LocaleProvider
import { LocaleProvider } from 'antd'; import fr_FR from 'antd/lib/locale-provider/fr_FR'; import 'moment/locale/fr'; ... return <LocaleProvider ...
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
You can import all modules from ‘antd/lib/xxx’: https://codesandbox.io/s/antd-reproduction-template-forked-wsy4t
Hey @jamalabo1 , have you fixed this issue? I’m still fighting, having similar problem here: https://github.com/ant-design/ant-design/issues/29907