Skip to content

Instantly share code, notes, and snippets.

@sethdavis512
Created April 8, 2025 14:12
Show Gist options
  • Save sethdavis512/a4cd1be969a1a61b4b71b1bfc06e3f92 to your computer and use it in GitHub Desktop.
Save sethdavis512/a4cd1be969a1a61b4b71b1bfc06e3f92 to your computer and use it in GitHub Desktop.
Config to publish component library
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path';
import dts from 'vite-plugin-dts';
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), dts({
include: ['src/components'],
rollupTypes: true,
tsconfigPath: './tsconfig.app.json'
})],
build: {
minify: true,
copyPublicDir: false,
lib: {
entry: resolve(__dirname, 'src/components/index.ts'),
name: 'treebird',
formats: ['es', 'umd'],
},
rollupOptions: {
external: ['react', 'react-dom', 'react/jsx-runtime'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'react/jsx-runtime': 'jsxRuntime',
},
},
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment