Uncaught TypeError: moment.locale is not a function
See original GitHub issueVersion
3.1.1
Environment
Windows 10, Chrome 63
Reproduction link
https://github.com/ant-design/parcel-antd
Steps to reproduce
- Change index.js of parcel sample to:
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'antd';
import { LocaleProvider } from 'antd';
// The default locale is en-US, but we can change it to other language
import frFR from 'antd/lib/locale-provider/fr_FR';
import moment from 'moment';
import 'moment/locale/fr';
ReactDOM.render(
<LocaleProvider locale={frFR}>
<Button type="primary">Button</Button>
</LocaleProvider>
, document.getElementById('mountNode'));
- Run app
What is expected?
Application will run successfully with locale loaded
What is actually happening?
Error thrown in console parcel-antd.js:27172 Uncaught TypeError: moment.locale is not a function at Object.require.6.moment (parcel-antd.js:27172) at newRequire (parcel-antd.js:42) at localRequire (parcel-antd.js:48) at Object.require.4.antd/es/locale-provider (parcel-antd.js:31853) at newRequire (parcel-antd.js:42) at require.183 (parcel-antd.js:67) at parcel-antd.js:72
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (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 >Uncaught TypeError: moment.defineLocale is not a function in ...
As of v2.8.1, moment.locale('en') sets the localization but does not return a moment .
Read more >moment/moment - Gitter
Hi, what happened to Duration Format Plugin, Uncaught TypeError: moment.duration(...).format is not a function at <anonymous>:1:33 ? (v2.2.1). Menencia.
Read more >How to use the moment.localeData function in moment - Snyk
To help you get started, we've selected a few moment examples, based on popular ways it is used in public projects. ; import...
Read more >Uncaught TypeError: moment.defineLocale is not a function in ...
Coding example for the question Uncaught TypeError: moment.defineLocale is not a function in use locale for change calture-moment.js.
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
@gregorysl @bytewiz the PR parcel-bundler/parcel#530 will not be merged. ~however I created #9594 to fix it without the Parcel PR. Feel free to try it and confirm me if it works for you.~ It was already fixed in #9528 🎉
I was using this fork: https://github.com/parcel-bundler/parcel/pull/530