moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Smaller library size of vanilla bundle?

Open probil opened this issue 6 years ago • 4 comments

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

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

probil avatar Aug 03 '19 13:08 probil

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

daybrush avatar Aug 03 '19 13:08 daybrush

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.

deepakjoy avatar Aug 16 '20 01:08 deepakjoy

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/[email protected]

Screen Shot 2022-04-30 at 8 57 44 AM

jamesopti avatar Apr 30 '22 15:04 jamesopti

@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]);

daybrush avatar May 01 '22 17:05 daybrush

@daybrush is it available in svelte-moveable package?

evanshe avatar Apr 11 '23 03:04 evanshe

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

daybrush avatar Apr 11 '23 18:04 daybrush

@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

osbre avatar Apr 15 '23 20:04 osbre

@osbre

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

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

daybrush avatar Apr 16 '23 20:04 daybrush