daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.15k stars 623 forks source link

Smaller library size of vanilla bundle? #15

Open probil opened 5 years ago

probil commented 5 years ago

Any plans to make vanilla bundle smaller? Currently it's around 70kb min

I think there is a potential to make it ~10kb min

daybrush commented 5 years ago

@probil

I think my worries are similar. Its size seems to grow as its functions become more and more. However, there is an intention to reduce it without increasing it on schedule.

deepakjoy commented 4 years ago

Yes, it would be great to have some way to pick the components needed, or even some precompiled combinations as a start. Currently, the minified version is 145kb, which makes it too large to include for the limited functionality I need.

Any tips on how to how remove components myself would also be helpful.

jamesopti commented 2 years ago

Surprised this doesnt have more votes/discussion

The core react-moveable bundle is quite large if youre only using one of the features, like resize.

https://bundlephobia.com/package/react-moveable@0.32.5

Screen Shot 2022-04-30 at 8 57 44 AM
daybrush commented 2 years ago

@jamesopti There is a way to support Tree Shacking only in react, and you can reduce the size.

import * as React from "react";
import { makeMoveable, ResizableProps, Resizable } from "react-moveable";

// In order to use only some able, make a component with makeMoveable function.
const Moveable = makeMoveable<ResizableProps>([Resizable]);
evanshe commented 1 year ago

@daybrush is it available in svelte-moveable package?

daybrush commented 1 year ago

@evanshe It will take time, but ultimately it will be a problem that will be solved.

Only react is provided so far, and other frameworks will support it as well.

osbre commented 1 year ago

@daybrush I think there is a way to make the Moveable library bundle 10x smaller by using preact-compat instead of React. Preact is a much smaller alternative to React which maintains compatibility with React API. Let me know what you think. Thank you.

https://preactjs.com/guide/v10/switching-to-preact

daybrush commented 1 year ago

@osbre

I am using croact(like preact) which I developed.

I plan to reduce the size by tree shaking the unused able.