date-fns: Missing buildLocalizeArrayFn module
I was trying to dynamically import locales from date-fns package and bumped into the following error:
Module not found: Can't resolve '../../../_lib/buildLocalizeArrayFn/index.js' in '/Users/ericreis/dev/vtex/test/node_modules/date-fns/locale/ar-DZ/_lib/localize'
Here is the code I’m using to perform the dynamic import:
const locale = 'en-GB'
import(`date-fns/locale/${locale}/index.js`).then(
data => {
console.log(data)
})
I searched everywhere for this buildLocalizeArrayFnfolder, but I didn’t find it anywhere. Is it a bug? If not, could anyone point to me what I am doing wrong?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 18 (14 by maintainers)
Commits related to this issue
- Remove outdated locales from the package (closes #1014) — committed to date-fns/date-fns by kossnocorp 5 years ago
- Remove outdated locales from the package (closes #1014) — committed to elmomalmo/date-fns by kossnocorp 5 years ago
- Remove outdated locales from the package (closes #1014) — committed to korzhyk/date-fns by kossnocorp 5 years ago
I’ve released a fix for this issue as
v2.0.0-alpha.34: https://gist.github.com/kossnocorp/a307a464760b405bb78ef5020a4ab136#v200-alpha34I did a work around for alpha 27 version by considering active locales
I created supportingLanguages.js with
and then where ever i wanted to import
@kossnocorp perhaps then these locales should me moved to a separate location? Dynamic import is a powerful feature that right now is breaking due to outdated files in modules that won’t even be called.