InhiblabCore / vue-hooks-plus

High performance & Simplicity 🧲 Vue 3 Hooks library
https://InhiblabCore.github.io/docs/hooks
MIT License
1.62k stars 102 forks source link

[Bug] tree shaking problem #228

Open Airkro opened 4 weeks ago

Airkro commented 4 weeks ago

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 commented 4 weeks ago

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 ";
NelsonYong commented 3 weeks ago

@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 commented 3 weeks ago

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