Comments (16)
Sure! I could probs take a look at this tomorrow.
from react-elastic-carousel.
@mAAdhaTTah But what if the consumer doesn't use these two libraries? I'm not sure that each tertiary dependency should be a peer-dependency, its exhausting to install them manually.
from react-elastic-carousel.
@sag1v They shouldn't be peerDeps, just regular deps, like React & SC are.
from react-elastic-carousel.
@sag1v They shouldn't be peerDeps, just regular deps, like React & SC are.
Well, react and SC are peerDeps.
from react-elastic-carousel.
@mAAdhaTTah I just remembered that rollup will bundle it ALL together via the commonjs
plugin..
from react-elastic-carousel.
@sag1v Yeah, that's the cause. I believe if you move them to deps
, the external
plugin will make sure they're not bundled.
from react-elastic-carousel.
@mAAdhaTTah nah, external()
will ignore all peerDeps.
If you see in package.json
, the only entry in dependencies is react-swipeable
(which is also included in the bundle), my mistake was not including both resize-observer
and classnames
there as well, but i see that they are included in the bundle anyway.
I suspect that rollup-plugin-node-resolve
and rollup-plugin-commonjs
are forcing them to be part of the bundle (maybe they check for imports to decide).
I still think the end results is good (though achieved in a wrong way), if you look at the peerDeps array, you notice that none of them are bundled, but requires to get installed by the consumer. I don't think making consumers explicitly install classnames
and resize-observer-polyfill
is a good thing.
BTW, i just realised that we use classnames
only in one place, i think of ditching it anyway.
from react-elastic-carousel.
@sag1v I agree that consumers should not need to install those libs to use the library. I disagree that the only alternative is to bundle non-peer-deps into the library. That's the behavior of the plugin you're using, but you could e.g. switch to auto-external
or even using rollup's external
to do it manually. Ultimately, my goal of opening this ticket is to remove those from the bundle so my installation can dedupe those dependencies appropriately.
from react-elastic-carousel.
Oh, to be clear, it's the behavior of rollup-plugin-peer-deps-external
.
from react-elastic-carousel.
@mAAdhaTTah I'm not sure i understand.
Whats do you think should be manually added to the external
array? And what would happen if consumers wont include it manually?
For example, if we put resize-observer-polyfill
in external
but the consumer is not using it nor including it in their project, then where should it come from?
from react-elastic-carousel.
@sag1v If resize-observer-polyfill
is in this library's package.json as a dependency
, npm or yarn will install it automatically for them.
from react-elastic-carousel.
Hmm something like this plugin?
https://www.npmjs.com/package/rollup-plugin-exclude-dependencies-from-bundle
from react-elastic-carousel.
Yeah that would work.
from react-elastic-carousel.
I would welcome a PR 😁
Will be nice if you check that its actually working well for you...
from react-elastic-carousel.
Available as of version 0.7.1
Thank you @mAAdhaTTah !
from react-elastic-carousel.
@sag1v Great, thank you!
from react-elastic-carousel.
Related Issues (20)
- error TS2769: No overload matches this call. TS HOT 6
- Typescript Support HOT 3
- focusOnSelect conflict with enableMouseSwipe HOT 1
- Support with react 18 HOT 11
- Bug in importing {consts} in typescript HOT 6
- Unable to Copy Text in react-elastic-carosuel. HOT 1
- On page load if we have 4 items in carousel then items in carousel shifting to right end. HOT 1
- Wrong type for onChange of ReactElasticCarouselProps HOT 2
- Wrong type in RenderArrow prop document HOT 1
- Typescript Error, but Carousel is working on browser HOT 5
- `rec-slider` not resizing when window height changes HOT 2
- is there support for react 18? HOT 1
- Breakpoints not working properly HOT 2
- Unable to resolve dependency tree after React 18 update. HOT 1
- If enableAutoPlay is enabled then after last item it should move to first item HOT 1
- Buttons are not having discernible text. HOT 5
- Peer Dependency Issue with React 18
- Can you resolve peer dependency issue with react 18.There is ongoing project with react 18 so can you resolve the peer dependency with react 18. HOT 10
- Always show the three dots HOT 1
- the ReactElasticCarousel not have Children's props HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-elastic-carousel.