Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(components): improve tree-shaking #2622

Closed
7 tasks done
vaakian opened this issue Jan 5, 2023 · 0 comments · Fixed by #2623
Closed
7 tasks done

(components): improve tree-shaking #2622

vaakian opened this issue Jan 5, 2023 · 0 comments · Fixed by #2623

Comments

@vaakian
Copy link
Contributor

vaakian commented Jan 5, 2023

Describe the bug

Just found a issue with the tree-shaking of package @vueuse/components, this is what I tested out:

The code

created a fresh project using pnpm create vue@latest.

<!-- App.vue -->
<script setup lang="ts">
import { UseMouse } from "@vueuse/components";
</script>

<template>
  <UseMouse #="{ x, y }">
    {{ x }}
    {{ y }}
  </UseMouse>
</template>

The build size

Build without /* #__PURE__ */ comments: 114.23 kB
image

No code change, same build with /* #__PURE__ */ comments: 65.82 kB
image

I checked that sideEffects field in the package.json of @vueuse/components is already set to false, but it did'nt work, maybe vite(rollup?) should fix this as well?

Reproduction

https://vueuse.org/

System Info

System:
    OS: macOS 13.0
    CPU: (8) arm64 Apple M1
    Memory: 131.22 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.1.0 - ~/.nvm/versions/node/v18.1.0/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.8.0 - ~/.nvm/versions/node/v18.1.0/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Firefox: 105.0.1
    Safari: 16.1
  npmPackages:
    @vueuse/components: ^9.10.0 => 9.10.0 
    vue: ^3.2.45 => 3.2.45

Used Package Manager

pnpm

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant