Skip to content

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

Open
@gVguy

Description

@gVguy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions