Cannot resolve date-fns/esm/locale
See original GitHub issueModule not found: Can't resolve 'date-fns/esm/locale' in ...'
I’m following the i18n example in the docs
import { es, ru } from 'date-fns/esm/locale'
In a Create React App generated project (ie webpack)
The esm folder does not exist in node_modules and I can only find it as a module value in package.json
How should we import locales?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Module not found: Can't resolve '@date-io/date-fns'
I'm using React Material UI and I get this error : Module not found: Can't resolve '@date-io/date-fns'. Here are the dependencies that I...
Read more >Module not found: Can't resolve '@date-io/date-fns' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve '@date-io/date-fns'", make sure to install the package by opening your terminal in your...
Read more >date-fns - npm
date -fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Read more >date-fns | Yarn - Package Manager
date -fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Read more >Can't resolve 'date-fns/_lib/format/longFormatters'
can't resolve 'date-fns/_lib/format/longformatters'. Add Answer | View In TPC Matrix. Technical Problem Cluster First Answered On July 12, 2021 Popularity ...
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 Free
Top 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
I confirm, there is an error in examples available at https://date-fns.org/:
Replace
import { es, ru } from 'date-fns/esm/locale'By
import en from 'date-fns/locale/en'import ru from 'date-fns/locale/ru'And it will works like a charm 👌
At the moment just a few locales are compatible with v2. See the list: https://github.com/date-fns/date-fns/blob/master/src/esm/locale/index.js. I also fixed a typo in the I18n doc: https://github.com/date-fns/date-fns/pull/741