HubSpot / odometer

Smoothly transitions numbers with ease. #hubspot-open-source
http://github.hubspot.com/odometer/docs/welcome
MIT License
7.3k stars 712 forks source link

Module not found: Error: Cannot resolve module 'jquery' #127

Closed jeerbl closed 7 years ago

jeerbl commented 7 years ago

Hello,

When define is defined and define.amd exists, it defines the module with a dependency on jQuery as you can see in the code below:

if (typeof define === 'function' && define.amd) {
  define(['jquery'], function() {
    return Odometer;
  });
} else if (typeof exports !== "undefined" && exports !== null) {
  module.exports = Odometer;
} else {
  window.Odometer = Odometer;
}

My project does not use jQuery and, when packaging with Webpack, I get the error

ERROR in ./~/odometer/odometer.js
Module not found: Error: Cannot resolve module 'jquery' in /Users/jbrunel/Documents/Projects/TrackInsight/view/src/public/map/node_modules/odometer
 @ ./~/odometer/odometer.js 644:4-646:6

Is there any reason why there is a dependency on jQuery when using define but not in the other cases?

I can provide a pull request to fix this if you are OK.

Thanks, Jerome

jeerbl commented 7 years ago

Created PR #128.

jeerbl commented 7 years ago

Fix merged in PR #128