Coder Social home page Coder Social logo

Comments (16)

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024 1

Sure! I could probs take a look at this tomorrow.

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

@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.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

@sag1v They shouldn't be peerDeps, just regular deps, like React & SC are.

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

@sag1v They shouldn't be peerDeps, just regular deps, like React & SC are.

Well, react and SC are peerDeps.

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

@mAAdhaTTah I just remembered that rollup will bundle it ALL together via the commonjs plugin..

from react-elastic-carousel.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

@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.

sag1v avatar sag1v commented on May 17, 2024

@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.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

@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.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

Oh, to be clear, it's the behavior of rollup-plugin-peer-deps-external.

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

@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.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

@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.

sag1v avatar sag1v commented on May 17, 2024

Hmm something like this plugin?
https://www.npmjs.com/package/rollup-plugin-exclude-dependencies-from-bundle

from react-elastic-carousel.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

Yeah that would work.

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

I would welcome a PR 😁
Will be nice if you check that its actually working well for you...

from react-elastic-carousel.

sag1v avatar sag1v commented on May 17, 2024

Available as of version 0.7.1
Thank you @mAAdhaTTah !

from react-elastic-carousel.

mAAdhaTTah avatar mAAdhaTTah commented on May 17, 2024

@sag1v Great, thank you!

from react-elastic-carousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.