brainhubeu / react-carousel

A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)
https://brainhub.eu/
MIT License
1.07k stars 164 forks source link

TypeError: e.resolve is not a function #672

Open fmsthird opened 3 years ago

fmsthird commented 3 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://brainhubeu.github.io/react-carousel/docs/examples/customArrows#custom-arrows
  2. Add slidesToShowPlugin in the resolve. In my case I did it like [arrowsPlugin, slidesToShowPlugin]
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

**Update***

When did it like this : resolve: arrowsPlugin, slidesToShowPlugin
only arrows plugin works but the slidesToShowPlugin is not working.

Screenshots If applicable, add screenshots to help explain your problem. image

rheng001 commented 3 years ago

You can use multiple plugins like this

<Carousel
      plugins={[
        {
          resolve: slidesToShowPlugin,
          options: {
            numberOfSlides: 6,
          },
        },
        {
          resolve: arrowsPlugin,
          options: {
            arrowLeft: (
              <button>
                <Icon name="angle-double-left" />
              </button>
            ),
            arrowLeftDisabled: (
              <button>
                <Icon name="angle-left" />
              </button>
            ),
            arrowRight: (
              <button>
                <Icon name="angle-double-right" />
              </button>
            ),
            arrowRightDisabled: (
              <button>
                <Icon name="angle-right" />
              </button>
            ),
            addArrowClickHandler: true,
          },
        },
      ]}
    >
      ........
    </Carousel>
rikinshah23 commented 2 years ago

@fmsthird were you able to solve this issue ?

rikinshah23 commented 2 years ago

I am having the same issue when using slidesToShowPlugin. TypeError: t.resolve is not a function

below is my code -

const Carousel = dynamic(import('@brainhubeu/react-carousel'), {
  ssr: false,
});

const slidesToShowPlugin = dynamic(
  () => {
    import('@brainhubeu/react-carousel').then((module) => {
      return module.slidesToShowPlugin;
    });
  },
  { ssr: false },
);

const slidesToScrollPlugin = dynamic(
  () => {
    import('@brainhubeu/react-carousel').then((module) => {
      return module.slidesToScrollPlugin;
    });
  },
  { ssr: false },
);
```
<div className="carousel1">
      <Carousel
        plugins={[
          {
            resolve: slidesToShowPlugin,
            options: {
              numberOfSlides: 2,
            },
          },
        ]}>
  // content here 
      </Carousel>
    </div>