vue-waypoint
vue-waypoint copied to clipboard
did bundle size increase going to version 4?
Hello,
Looking at bundle phobia, the gzipped bundle size went from 1.1kB to 40.4kB betrween version 3 and 4. Does that seem right?
https://bundlephobia.com/package/vue-waypoint
This repository contains a whole application in order to have a working test. This does not mean that you should use the whole repository (you can use just the component, which is (https://github.com/scaccogatto/vue-waypoint/blob/master/src/components/Waypoint/component.vue)
But if you can strip everything off, PRs are welcome!
Definitely, something is happening 🤔
I gave it a try to build Waypoint using Vite, it's only 2.5KB
And file content is very small 🤔
❯ npm run build
> [email protected] build
> vue-tsc --noEmit && vite build
vite v3.0.0 building for production...
✓ 4 modules transformed.
dist/waypoint.js 2.54 KiB / gzip: 1.03 KiB
dist/waypoint.umd.cjs 2.15 KiB / gzip: 1.00 KiB
Waypoint with Vite

Unpkg that shows huge file sizes

Can you make a PR with a vite-based build system?
Sure. Later today will do!
@scaccogatto ok so the build is fine, but it seems there is a problem with the actual code using the latest vue
, the @change
callback is called indefinitely 🤔 The same happens in current code if I update dependencies. This happens because of this:
onMounted(() => (mounted.value = true));
onBeforeUpdate(() => (mounted.value = false));
onUpdated(() => (mounted.value = true));
onBeforeUnmount(() => (mounted.value = false));
mounted
value gets switched true/false, which triggers an update, and the update triggers methods again. This behavior starts from Vue 3.2
I suppose onBeforeUpdate
and onUpdated
should be deleted, and onBeforeUnmount
replaced with onUnmounted
What was the last command used for building the library? It is possible that you included --inline-vue
flag, that's why the bundle is so big 🤔
ps: I'm not using this library in any project, just want to help
This hook is sensitive, I would like to investigate. If you open the PR with just the build change I can maybe try to fix the thing.
@scaccogatto PR ready for review!