-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.lib.ts
More file actions
46 lines (45 loc) · 1.13 KB
/
vite.config.lib.ts
File metadata and controls
46 lines (45 loc) · 1.13 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
45
46
import { defineConfig } from 'vite'
import { resolve } from 'path'
import dts from 'vite-plugin-dts'
export default defineConfig({
build: {
lib: {
entry: {
index: resolve(__dirname, 'src/lib-index.ts'),
'react/index': resolve(__dirname, 'src/react.tsx')
},
formats: ['es', 'cjs'],
fileName: (format, entryName) => {
const ext = format === 'es' ? 'mjs' : 'js'
return entryName === 'index' ? `index.${ext}` : `${entryName}.${ext}`
}
},
rollupOptions: {
external: [
'react',
'react-dom',
'@mantine/core',
'@mantine/hooks',
'@mantine/dropzone',
'@mantine/notifications',
'@mantine/code-highlight',
'@tabler/icons-react'
],
output: {
preserveModules: true,
preserveModulesRoot: 'src'
}
},
target: 'esnext',
sourcemap: true,
minify: false
},
plugins: [
dts({
insertTypesEntry: true,
rollupTypes: false,
include: ['src/**/*'],
exclude: ['src/**/*.test.ts', 'src/**/*.spec.ts', 'vite.config.ts', 'vite.config.lib.ts']
})
]
})