Created
April 8, 2025 14:12
-
-
Save sethdavis512/a4cd1be969a1a61b4b71b1bfc06e3f92 to your computer and use it in GitHub Desktop.
Config to publish component library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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