-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathvite.lib.config.ts
More file actions
44 lines (42 loc) · 1.22 KB
/
vite.lib.config.ts
File metadata and controls
44 lines (42 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react'
/**
* Library build configuration.
* Run via: npm run build:lib
*
* Outputs:
* dist/index.js — ESM bundle (tree-shakeable)
* dist/index.css — Tailwind-generated stylesheet (consumers must import separately)
* dist/index.d.ts — TypeScript declarations (generated by tsc, see tsconfig.build.json)
*/
const src = new URL('src', import.meta.url).pathname
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': src,
},
},
build: {
lib: {
entry: `${src}/app/components/openapi-designer/index.ts`,
name: 'OpenAPIDesigner',
formats: ['es'],
fileName: 'index',
},
rollupOptions: {
// React must be provided by the consumer (peer dependency).
external: ['react', 'react-dom', 'react/jsx-runtime'],
output: {
// Write CSS asset as dist/index.css so the exports map resolves correctly.
assetFileNames: 'index.[ext]',
},
},
outDir: 'dist',
emptyOutDir: true,
sourcemap: true,
// Emit a single CSS file instead of per-chunk splits.
cssCodeSplit: false,
},
})