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

CustomElements library bundle size is significantly larger than the docs state. #3056

Open
gVguy opened this issue Oct 10, 2024 · 0 comments

Comments

@gVguy
Copy link

gVguy commented Oct 10, 2024

Here's what it says in the docs:

When building custom elements with Vue, the elements will rely on Vue's runtime. There is a ~16kb baseline size cost depending on how many features are being used.

In my local environment I was getting a bundle a lot larger than that, even though there wasn't a whole lot happening in the actual library code, so I got suspicious about that number in the docs.

So I've created a minimal sample project on stackblitz to test my theory. Which is barebones Vite + only 2 empty Vue components building as a custom elements library - and they're literally empty, just a single <div /> in each of them.

And here's what it builds:

dist/output.js  150.92 kB │ gzip: 46.35 kB 
dist/output.umd.cjs  101.04 kB │ gzip: 37.39 kB

That's a bit more than 16 kb, even compressed. Maybe we should modify the docs because that looks misleading.

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

No branches or pull requests

1 participant