angular-timer: humanizeDuration is not defined

I use requirejs for loading my module. In requirejs, I add below code:

require.config({
          baseUrl: 'libs'.
          paths: {
                 'angular': 'path/to/angular',
                 'angular-timer': 'angular-timer/dist/angular-timer.min',
                 'humanize-duration': 'path/to/humanize',
                 'moment': 'path/to/moment'
          },
         shim: {
                'angular-timer': ['angular', 'moment', 'humanize-duration']
         }
});

But, the console always said that humanizeDuration is not defined, but moment is defined inside angular-timer.min.js

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 21 (1 by maintainers)

Most upvoted comments

The way I am currently able to work with webpack is to add plugin as: new webpack.ProvidePlugin({ 'moment': 'moment', 'humanizeDuration': 'humanize-duration' })

I’m getting same error humanizeDuration is not defined…???

i have the same issue “humanizeDuration is not defined” in including angular timer
how to solve that ?

I got it to work by adding humanize-duration.js and moment.js after angular-timer.min.js.
Its dependent on these other 2 libraries. Get the libraries from Github.

<script src="../lib/angular-1.6.6/angular.js"></script> <script src="js/angular-timer.min.js"></script> <script src="js/humanize-duration.js"></script> <script src="js/moment.js"></script>

same

Same issue

+1 same issue.

I’m just writing my own timer, I can’t stand any unnecessary dependencies.