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.

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

Edit on CodeSandbox

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
afc163commented, Mar 3, 2021

You can import all modules from ‘antd/lib/xxx’: https://codesandbox.io/s/antd-reproduction-template-forked-wsy4t

1reaction
chemicalkosekcommented, Jul 25, 2021

Hey @jamalabo1 , have you fixed this issue? I’m still fighting, having similar problem here: https://github.com/ant-design/ant-design/issues/29907

Read more comments on GitHub >

github_iconTop 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 >

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