feat: add Vite library build config with dts generation
Separate vite.lib.config.ts for library mode builds: - ES module output (index.es.js) with react/react-dom externalized - Consolidated type declarations via rollupTypes (index.es.d.ts) - CSS Modules with debuggable scoped names (cameleer_ prefix) - Deterministic output filenames (style.css, index.es.js) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,5 +20,5 @@
|
|||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUncheckedSideEffectImports": true
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": ["vite.config.ts", "vite.lib.config.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
34
vite.lib.config.ts
Normal file
34
vite.lib.config.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
import dts from 'vite-plugin-dts'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
react(),
|
||||||
|
dts({
|
||||||
|
include: ['src/design-system'],
|
||||||
|
exclude: ['**/*.test.tsx', '**/*.test.ts'],
|
||||||
|
outDir: 'dist',
|
||||||
|
tsconfigPath: resolve(__dirname, 'tsconfig.app.json'),
|
||||||
|
rollupTypes: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
css: {
|
||||||
|
modules: {
|
||||||
|
localsConvention: 'camelCase',
|
||||||
|
generateScopedName: 'cameleer_[name]_[local]_[hash:5]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: resolve(__dirname, 'src/design-system/index.ts'),
|
||||||
|
formats: ['es'],
|
||||||
|
fileName: () => 'index.es.js',
|
||||||
|
cssFileName: 'style',
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
external: ['react', 'react-dom', 'react-router-dom', 'react/jsx-runtime'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user