-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
52 lines (50 loc) · 1.52 KB
/
vite.config.ts
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
47
48
49
50
51
52
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import path from 'path'
// VITE_REACT_DEPLOY_DOCUMENTATION viene de tu script "deploy"
const isDocs = process.env.VITE_REACT_DEPLOY_DOCUMENTATION === 'DOCUMENTATION'
export default defineConfig({
plugins: [react(), tsconfigPaths()],
build: {
// Cuando sea docs, salida por defecto (dist/)
// y no usaremos el modo "lib"
...(isDocs
? {
// build de la web de componentes
sourcemap: true,
rollupOptions: {
external: [], // empaquetar todo
},
}
: {
// build de la librería
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: '@eclass/ui-kit',
fileName: (format: string) => `eclass-ui-kit.${format}.js`,
},
sourcemap: true,
rollupOptions: {
external: [
'react',
'react-dom',
'@chakra-ui/react',
'@emotion/react',
'@emotion/styled',
'framer-motion',
],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@chakra-ui/react': 'Chakra',
'@emotion/react': 'EmotionReact',
'@emotion/styled': 'EmotionStyled',
'framer-motion': 'framerMotion',
},
},
},
}),
},
})