0
votes

I found moment.js had supported ES6, but when I import it

import moment from 'moment';

I got an error like this:

angular.js?5638:68Uncaught  Error: [ng:areq] Argument 'fn' is not a function, got Moment

I had tried some different way to do:

import moment from 'moment/src/moment';

still does not work.

Are you using a module loader? E.g.: github.com/systemjs/systemjs SystemJS is a universal module loader, which can also be used to load other module formats.dinony
When using webpack you need to add in module.exports{entry:{"moment"}}Niels Steenbeek
no,last I config it in webpack to be global then it works. it can be import but may be a compatibility error . I saw it did have a fix for es6.niceduan