Files
soleprint/soleprint/common/ui/vite.config.ts
2026-08-10 03:23:30 -03:00

38 lines
1.1 KiB
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
/**
* Library build — emits dist/soleprint-ui.js plus a single dist/style.css
* containing the theme (tokens + base) and every component's scoped styles.
*
* The CSS is the point as much as the JS: components style themselves with
* var(--surface-0) and friends, so a bundle shipped without it renders broken.
*
* Peer packages are external so a consuming app resolves ONE copy of vue —
* two Vue instances break reactivity and provide/inject in ways that are
* miserable to debug.
*/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
lib: {
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
formats: ['es'],
fileName: () => 'soleprint-ui.js',
cssFileName: 'style',
},
rollupOptions: {
external: ['vue', 'pinia', '@vue-flow/core', 'uplot'],
output: {
globals: { vue: 'Vue' },
},
},
},
})