Using require('module-name') with meteor packages

Hi all,

My meteor app is meteor-1.6 based, having jquery installed by “meteor add” and bootstrap-slider from copied under client/compatibility/.

The app basically works find, but in development run “meteor run” I got this warning:

Unable to resolve some modules:

  "jquery" in client/compatibility/bootstrap-slider.js (web.browser)
If you notice problems related to these missing modules, consider running:
  meteor npm install --save jquery

I guess this caused by require(“jquery”) inside bootstrap-slider.js.
How can I avoid this warning without duplicating jquery in my app with “meteor npm install --save jquery”?

Easiest is to edit it just a little bit on line 60 to replace require('jquery') with window.jQuery
Then it will use the global jQuery provided by meteor and still export it’s symbol as a module

Or delete lines: 55-65 (and 67)

in which case it will use global jQuery and make itself global as well

1 Like

Thank you coagmano!
It worked.