Building a package rather than a site means externalising the framework, emitting several formats, and not bundling anything the consumer already has.
export default defineConfig({
build: {
lib: {
entry: 'src/index.js',
name: 'TurkerDevUi',
formats: ['es', 'umd'],
},
rollupOptions: {
external: ['vue'],
output: { globals: { vue: 'Vue' } },
},
},
})
Forgetting external is the mistake that produces a package shipping its own copy of the framework, which in a Vue library means two reactivity systems and components that do not talk to each other. The globals mapping is only needed for the UMD build and is required for it, which is an asymmetry that produces a confusing build error.