@@ -3,43 +3,34 @@ import react from '@vitejs/plugin-react'
3
3
import tsconfigPaths from 'vite-tsconfig-paths'
4
4
import path from 'path'
5
5
6
- // https://vitejs.dev/config/
7
-
8
- let myDefineConfig
9
-
10
- const buildEnv = process . env . VITE_REACT_DEPLOY_DOCUMENTATION
11
-
12
- if ( buildEnv === 'DOCUMENTATION' ) {
13
- myDefineConfig = {
14
- plugins : [ react ( ) , tsconfigPaths ( ) ] ,
15
- build : {
16
- sourcemap : true ,
6
+ export default defineConfig ( {
7
+ plugins : [ react ( ) , tsconfigPaths ( ) ] ,
8
+ 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` ,
17
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'
32
+ }
33
+ }
34
+ }
18
35
}
19
- } else {
20
- myDefineConfig = {
21
- plugins : [ react ( ) , tsconfigPaths ( ) ] ,
22
- build : {
23
- lib : {
24
- entry : path . resolve ( __dirname , 'src/index.ts' ) ,
25
- name : '@eclass/ui-kit' ,
26
- fileName : ( format : string ) => `eclass-ui-kit.${ format } .js` ,
27
- } ,
28
- sourcemap : true ,
29
- rollupOptions : {
30
- // make sure to externalize deps that shouldn't be bundled
31
- // into your library
32
- external : [ 'react' ] ,
33
- output : {
34
- // Provide global variables to use in the UMD build
35
- // for externalized deps
36
- globals : {
37
- react : 'React' ,
38
- } ,
39
- } ,
40
- } ,
41
- } ,
42
- }
43
- }
44
-
45
- export default defineConfig ( myDefineConfig )
36
+ } )
0 commit comments