-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
64 lines (63 loc) · 1.93 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
53
54
55
56
57
58
59
60
61
62
63
64
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import * as path from 'path';
import dts from 'vite-plugin-dts';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), dts()],
optimizeDeps: {
include: ['react/jsx-runtime'],
},
build: {
lib:
{
entry: path.resolve(__dirname, 'src'),
name: 'use-up',
formats: ["cjs", 'es', 'umd'],
fileName: (format) => `index.${format}.js`
}
,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
'axios',
"react",
"react/jsx-runtime",
"react-dom",
"classnames",
"antd",
"i18next",
"react-i18next",
"@reduxjs/toolkit",
"js-config-helper",
"@apollo/client",
"object-assign",
"js-form-helper"
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
'axios': 'axios',
'js-config-helper': 'Config',
'js-form-helper': 'Form',
'react': 'React',
'react/jsx-runtime': 'jsxRuntime',
'antd': 'antd',
'i18next': 'i18next',
'object-assign': 'object-assign',
'react-i18next': 'reactI18next',
'@apollo/client': 'apolloClient',
"react-dom": 'ReactDOM'
}
}
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setup.ts',
css: false,
},
})