@@ -3,27 +3,38 @@ import { resolve } from 'path'
3
3
import vue from '@vitejs/plugin-vue'
4
4
5
5
// https://vitejs.dev/config/
6
- export default defineConfig ( {
7
- plugins : [ vue ( ) ] ,
8
- build : {
9
- lib : {
10
- // Could also be a dictionary or array of multiple entry points
11
- entry : resolve ( __dirname , 'lib/index.ts' ) ,
12
- name : 'Vue3DeviceDetect' ,
13
- // the proper extensions will be added
14
- fileName : 'vue3-device-detect' ,
15
- } ,
16
- rollupOptions : {
17
- // make sure to externalize deps that shouldn't be bundled
18
- // into your library
19
- external : [ 'vue' ] ,
20
- output : {
21
- // Provide global variables to use in the UMD build
22
- // for externalized deps
23
- globals : {
24
- vue : 'Vue' ,
6
+ export default defineConfig ( ( { command, mode } ) => {
7
+ if ( mode === "prod" ) {
8
+ return {
9
+ plugins : [ vue ( ) ] ,
10
+ build : {
11
+ lib : {
12
+ // Could also be a dictionary or array of multiple entry points
13
+ entry : resolve ( __dirname , "lib/index.ts" ) ,
14
+ name : "Vue3DeviceDetect" ,
15
+ // the proper extensions will be added
16
+ fileName : "vue3-device-detect" ,
17
+ } ,
18
+ rollupOptions : {
19
+ // make sure to externalize deps that shouldn't be bundled
20
+ // into your library
21
+ external : [ "vue" ] ,
22
+ output : {
23
+ // Provide global variables to use in the UMD build
24
+ // for externalized deps
25
+ globals : {
26
+ vue : "Vue" ,
27
+ } ,
28
+ } ,
25
29
} ,
26
30
} ,
27
- } ,
28
- } ,
31
+ } ;
32
+ } else {
33
+ return {
34
+ plugins : [ vue ( ) ] ,
35
+ build : {
36
+ outDir : "demo"
37
+ }
38
+ } ;
39
+ }
29
40
} )
0 commit comments