moment.localeData is not a function
See original GitHub issueHi I use it in React 16.8.6.
.
.
.
import moment from 'moment-jalaali';
import fa from 'moment/src/locale/fa';
.
.
.
useEffect(() => {
moment.locale('fa', fa);
moment.loadPersian();
}, []);
.
.
.
It returns an error:
index.js?a67b:197 Uncaught TypeError: moment.localeData is not a function at eval (index.js?a67b:197) at Object…/node_modules/moment-jalaali/index.js (vendors~main.chunk.js:4637) at webpack_require (main.js:787) at fn (main.js:150) at eval (index.js:11) at Module…/app/containers/PayResult/index.js (main.js:1632) at webpack_require (main.js:787) at fn (main.js:150) at eval (index.js?b8af:1) at Module…/app/containers/App/index.js (main.js:1188)
and
[HMR] bundle has 1 warnings client.js?f33d:189 ./node_modules/moment/src/lib/locale/locales.jsModule not found: Error: Can’t resolve ‘./locale’ in ‘/Users/Erfan/WebstormProjects/myproject/node_modules/moment/src/lib/locale’
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Uncaught TypeError: moment.locale is not a function #636
Hello, I have a react application served by nginx and im getting following error: twix.js:630 Uncaught TypeError: moment.locale is not a ...
Read more >moment.localeData is not a function error message
I'm using moment library, I want to initial localeData function. but I got this error: Uncaught TypeError: moment.localeData is not a ...
Read more >How to use the moment.localeData function in moment - Snyk
To help you get started, we've selected a few moment.localeData examples, based on popular ways it is used in public projects.
Read more >LocaleData
LocaleData extends dayjs().localeData API to supply locale data. var localeData = require('dayjs/plugin/localeData') dayjs.extend(localeData) dayjs().
Read more >Accessing locale specific functionality - momentjs.com
You can access the properties of the currently loaded locale through the moment.localeData(key) function. It returns the current locale or a locale with...
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
@alitaheri Finally, I found the solution! I should change the order in
internals/webpack/webpack.base.babel.jsFrom:
To
@reza3vi did not work for me