@@ -3,34 +3,51 @@ import react from '@vitejs/plugin-react'
3
3
import tsconfigPaths from 'vite-tsconfig-paths'
4
4
import path from 'path'
5
5
6
+ // VITE_REACT_DEPLOY_DOCUMENTATION viene de tu script "deploy"
7
+ const isDocs = import . meta. env . VITE_REACT_DEPLOY_DOCUMENTATION === 'DOCUMENTATION'
8
+
6
9
export default defineConfig ( {
7
10
plugins : [ react ( ) , tsconfigPaths ( ) ] ,
8
11
build : {
9
- lib : {
10
- entry : path . resolve ( __dirname , 'src/index.ts' ) ,
11
- name : '@eclass/ui-kit' ,
12
- fileName : ( format : string ) => `eclass-ui-kit.${ format } .js` ,
13
- } ,
14
- sourcemap : true ,
15
- rollupOptions : {
16
- external : [
17
- 'react' ,
18
- 'react-dom' ,
19
- '@chakra-ui/react' ,
20
- '@emotion/react' ,
21
- '@emotion/styled' ,
22
- 'framer-motion'
23
- ] ,
24
- output : {
25
- globals : {
26
- react : 'React' ,
27
- 'react-dom' : 'ReactDOM' ,
28
- '@chakra-ui/react' : 'Chakra' ,
29
- '@emotion/react' : 'EmotionReact' ,
30
- '@emotion/styled' : 'EmotionStyled' ,
31
- 'framer-motion' : 'framerMotion'
12
+ // Cuando sea docs, salida por defecto (dist/)
13
+ // y no usaremos el modo "lib"
14
+ ...( isDocs
15
+ ? {
16
+ // build de la web de componentes
17
+ outDir : 'dist-docs' ,
18
+ sourcemap : true ,
19
+ rollupOptions : {
20
+ external : [ ] , // empaquetar todo
21
+ } ,
32
22
}
33
- }
34
- }
35
- }
23
+ : {
24
+ // build de la librería
25
+ lib : {
26
+ entry : path . resolve ( __dirname , 'src/index.ts' ) ,
27
+ name : '@eclass/ui-kit' ,
28
+ fileName : ( format : string ) => `eclass-ui-kit.${ format } .js` ,
29
+ } ,
30
+ sourcemap : true ,
31
+ rollupOptions : {
32
+ external : [
33
+ 'react' ,
34
+ 'react-dom' ,
35
+ '@chakra-ui/react' ,
36
+ '@emotion/react' ,
37
+ '@emotion/styled' ,
38
+ 'framer-motion' ,
39
+ ] ,
40
+ output : {
41
+ globals : {
42
+ react : 'React' ,
43
+ 'react-dom' : 'ReactDOM' ,
44
+ '@chakra-ui/react' : 'Chakra' ,
45
+ '@emotion/react' : 'EmotionReact' ,
46
+ '@emotion/styled' : 'EmotionStyled' ,
47
+ 'framer-motion' : 'framerMotion' ,
48
+ } ,
49
+ } ,
50
+ } ,
51
+ } ) ,
52
+ } ,
36
53
} )
0 commit comments