0

I have to use Meteor with React for a school project. I build a website in which I'd like to add a carousel.

To do so, I tried to use : https://github.com/vazco/meteor-universe-react-carousel/

With the example script :

var React = require('react');
var Slider = require('react-slick');

var SimpleSlider = React.createClass({
  render: function () {
    var settings = {
      dots: true,
      infinite: true,
      speed: 500,
      slidesToShow: 1,
      slidesToScroll: 1
    };
    return (
      <Slider {...settings}>
        <div><h3>1</h3></div>
        <div><h3>2</h3></div>
        <div><h3>3</h3></div>
        <div><h3>4</h3></div>
        <div><h3>5</h3></div>
        <div><h3>6</h3></div>
      </Slider>
    );
  }
});

Using this code, I get : ReferenceError: require is not defined (l1)

After some research, I saw several solutions that didn't work for me, like using Meteor.require or Npm.require.

I followed links like 'require is not defined' in Meteor.js when including NPM package or Meteor cannot find module "module"

Now I'm a bit lost in all this, how can I use a package imported with meteor add package ? Is meteorite deprecated, do I need to use npm ?

Thanks in advance for your help.

Community
  • 1
  • 1
Sogeking
  • 25
  • 1
  • 4

1 Answers1

0

how can I use a package imported with meteor add package

Meteor packages are exported to the global namespace and are made available to the client and/or the server as declared in the package's package.js file. Module support is coming in Meteor 1.3. That example in the documentation is not possible without adding another package that supports the require syntax, such as meteorhacks:npm and/or cosmos:browserify.

Brendan Turner
  • 430
  • 2
  • 12