rmolinamir / hero-slider

A hero slider component. Includes autoplay, touch swiping, multiple navs, event callbacks, and more.
https://rmolinamir.github.io/hero-slider/?path=/story/example-hero-slider--basic
102 stars 23 forks source link

styled-components dependency #2

Closed coudron closed 4 years ago

coudron commented 5 years ago

Nice Sliders!

Heads up, there's some bug around styled-components dependencies. I was getting this error until I manually installed styled-components

ERROR in ./node_modules/hero-slider/dist/index.es.js
Module not found: Error: Can't resolve 'styled-components' in
'/Users/<project-folder>/node_modules/hero-slider/dist'

Cheers, Chris

istrapi commented 4 years ago

Same and also it does not work with Nextjs ssr it requires window

rmolinamir commented 4 years ago

Hello and thanks @coudron. I apologize this went completely under my radar as I have this repo on very low maintenance. A refactor is due. I apologize for having missed adding that note in the documentation 🤦

styled-components is actually a peer dependency as you can see in the package.json, you'd need to install styled-components independently of this package.

By the way @istrapi, if by chance you're still looking to use the package, could you open an issue with more details to see what's going on? I did use this package in a Next.js SSR application, as shown here.

Wahagn commented 4 years ago

I get this same error even after installing styled-components, does it maybe only work with an older version of styled-components? The version I have installed is: "styled-components": "^5.1.1",

Module not found: Error: Can't resolve 'styled-components' in '/app/node_modules/hero-slider/dist' dashboard_1 | @ ./node_modules/hero-slider/dist/index.es.js

EDIT: nevermind, I got it working

rmolinamir commented 4 years ago

@Wahagn thanks for the info & update, was your solution basically tinkering with the package.json?

I'm thinking of refactoring the usage of styled-components while at the same time simply use CSS, and also adding support the styled-components API and other CSS related ones by allowing components to receive classes/styles.

Wahagn commented 4 years ago

@rmolinamir

I uninstalled the 5.X.X version of styled-components, then I installed the version which was available at the time of this post (sept 1, 2019) which is 4.3.2 then I built my project with docker-compose for changes to take place. Not 100% sure whether it was the version change or the built was not totally successful the first time but it works now

rmolinamir commented 4 years ago

@Wahagn thank you very much for the info. The component definitely needs to be refactored, much of the logic needs to be abstracted from the slider too, so I'll work on also refactoring the way I'm generating the CSS and make it package agnostic in the same update.

rmolinamir commented 4 years ago

Closed this one and opened a new issue for the refactor:

https://github.com/rmolinamir/hero-slider/issues/3