zillow / react-slider

Accessible, CSS agnostic, slider component for React.
https://zillow.github.io/react-slider
MIT License
892 stars 231 forks source link

RequireJS issues #31

Closed basharov closed 9 years ago

basharov commented 9 years ago

When I include react-slider into my RequireJS config, it throws this:

image

But when I remove it, all works fine without this library. What can lead to this error?

qwtel commented 9 years ago

The component uses Universal Module Definition (good explanation here). The relevant code is right at the beginning:

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(['react'], factory);
  } else if (typeof exports === 'object') {
    module.exports = factory(require('react'));
  } else {
    root.ReactSlider = factory(root.React);
  }
}(this, function (React) {

It assumes that you have defined an alias (not sure what the exact requirejs term is) for the name "react" that maps to a specific location.