Moment: Uncaught TypeError: __webpack_require__.i(...) is not a function

Created on 10 Oct 2017  ·  14Comments  ·  Source: moment/moment

Description of the Issue and Steps to Reproduce:

Uncaught TypeError: __webpack_require__.i(...) is not a function
    at Object.../../../../moment/src/lib/units/year.js (vendor.bundle.js:47527)
    at __webpack_require__ (inline.bundle.js:55)
    at Object.../../../../moment/src/lib/moment/get-set.js (vendor.bundle.js:44718)
    at __webpack_require__ (inline.bundle.js:55)
    at Object.../../../../moment/src/lib/units/month.js (vendor.bundle.js:46328)
    at __webpack_require__ (inline.bundle.js:55)
    at Object.../../../../moment/src/lib/locale/base-config.js (vendor.bundle.js:43484)
    at __webpack_require__ (inline.bundle.js:55)
    at Object.<anonymous> (vendor.bundle.js:43805)
    at Object.../../../../moment/src/lib/locale/locales.js (vendor.bundle.js:44010)

Please include the values of all variables used.

Environment:

Examples: Chrome 49 on OSX, Internet Explorer 10 on Windows 7, Node.JS 4.4.4 on Ubuntu 16.0.4

Latest Chrome on Mac
Angular 4 on Kubernetes Linux Cluster

Both the browser and the OS are important to us, particularly if you have an unsual environment like an IOT application.

Other information that may be helpful:

  • The time zone setting of the machine the code is running on
    UTC+2
  • The time and date at which the code was run
    Just now.
  • Other libraries in use (TypeScript, Immutable.js, etc)
    Typescript, Angular4, Angular-CLI

If you are reporting an issue, please run the following code in the environment you are using and include the output:

Logger of Browser

Ensure your issue is isolated to moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.

Most helpful comment

I ended up getting past this by changing:

import * as moment from 'moment';

to:

import * as moment from 'moment/moment';

All 14 comments

I spent the whole day before realizing this was the issue!

You resolved it?

@nottinhill do you solved the problem?

@nottinhill .. I just reverted back to my previous moment version

@joshjohn1984 what version did you change? the angular2-moment one or moment one?

Our team had the same issue after autoinstalling 1.19, fixed everything by uninstalling and specifically npm install [email protected]

error was:
year.js:84 Uncaught TypeError: __webpack_require__.i(...) is not a function
at Object. (year.js:84)
at __webpack_require__ (bootstrap 2097b80…:686)
at fn (bootstrap 2097b80…:105)
at Object.exports.__esModule (get-set.js:6)
at __webpack_require__ (bootstrap 2097b80…:686)
at fn (bootstrap 2097b80…:105)
at Object. (month.js:1)
at __webpack_require__ (bootstrap 2097b80…:686)
at fn (bootstrap 2097b80…:105)
at Object. (base-config.js:6)
(anonymous) @ year.js:84

I ended up getting past this by changing:

import * as moment from 'moment';

to:

import * as moment from 'moment/moment';

@morrisonbrett Would you need to do code changes then?
@matthew-sutterlin define autoinstalling 1.19.

Yes, I had to update the import statement in all usages of moment. You can also alias the package per: https://github.com/moment/moment/issues/4216#issuecomment-335637520

I have been facing this issue since yesterday, my moment version is 2.18.1, no changes in moment version since beginning. I have no import moment statements, any suggestions?

This happens because of corrupted 2.19 moment version.
In my project we use angular2-moment, which is linked to moment. See the version - it is not strictly defined.

  "dependencies": {
    "moment": "^2.16.0"
  },

Once moment got updated, our project got failed.
We had to explicitly add
"moment":"2.18.1"
to our package.json and the issue had gone.

@Jerome-Joestar is this version defined in your package.json?
When you build the project and see the issue, you can see the actual sources in the browser. Does that file still say "2.18.1"?

@4apkis Just checked and you are correct it bumped the version up to 2.19.0, setting it strictly to 2.18.1. Thanks!

Dup #4216

Was this page helpful?
0 / 5 - 0 ratings