vue-hooks-plus icon indicating copy to clipboard operation
vue-hooks-plus copied to clipboard

[Bug] tree shaking problem

Open Airkro opened this issue 1 year ago • 3 comments

Describe the bug

Some hooks will import all hooks.

For example: useInfiniteScroll

https://github.com/InhiblabCore/vue-hooks-plus/blob/2a8fd77d5adab1f59d042dbacc7b407631aefa92/packages/hooks/src/useInfiniteScroll/index.ts#L2

image

Steps to reproduce

import useInfiniteScroll from 'vue-hooks-plus/es/useInfiniteScroll';

System Info

no

Used Package Manager

pnpm

Validations

Airkro avatar Aug 16 '24 03:08 Airkro

change them like:

// packages/hooks/src/useInfiniteScroll/index.ts

import { useBoolean, useEventListener, useRequest } from "../index"; 

Into:

// packages/hooks/src/useInfiniteScroll/index.ts

import useBoolean from "../useBoolean";
import useEventListener from "../useEventListener";
import useRequest  from "../useRequest ";

Airkro avatar Aug 16 '24 03:08 Airkro

@Airkro Thank you for your feedback. I will check and optimize the code, and I will be updating and improving it soon. Please stay tuned for the latest version.

NelsonYong avatar Aug 18 '24 11:08 NelsonYong

The translation is: "If you're interested, feel free to submit a PR to make it better. 🤩

NelsonYong avatar Aug 18 '24 11:08 NelsonYong