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.

Uncaught TypeError: moment.locale is not a function

See original GitHub issue

Version

3.1.1

Environment

Windows 10, Chrome 63

Reproduction link

https://github.com/ant-design/parcel-antd

Steps to reproduce

  1. 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'));
  1. 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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fathybcommented, Mar 9, 2018

@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 🎉

0reactions
gregoryslcommented, Mar 9, 2018
Read more comments on GitHub >

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

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