docs icon indicating copy to clipboard operation
docs copied to clipboard

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

Open gVguy opened this issue 1 year ago • 0 comments

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.

gVguy avatar Oct 10 '24 14:10 gVguy